Added registration_enabled configuration
This commit is contained in:
parent
c6ef1120f8
commit
945fcb079a
|
@ -44,6 +44,9 @@ return [
|
|||
// Number of News shown on one site
|
||||
'display_news' => 6,
|
||||
|
||||
// Users are able to sign up
|
||||
'registration_enabled' => true,
|
||||
|
||||
// Only arrived angels can sign up for shifts
|
||||
'signup_requires_arrival' => false,
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ function logout_title()
|
|||
*/
|
||||
function guest_register()
|
||||
{
|
||||
global $user;
|
||||
global $user, $privileges;
|
||||
$tshirt_sizes = config('tshirt_sizes');
|
||||
$enable_tshirt_size = config('enable_tshirt_size');
|
||||
$min_password_length = config('min_password_length');
|
||||
|
@ -75,6 +75,14 @@ function guest_register()
|
|||
}
|
||||
}
|
||||
|
||||
if (!in_array('register', $privileges) || (!isset($user) && !config('registration_enabled'))) {
|
||||
error(_('Registration is disabled.'));
|
||||
|
||||
return page_with_title(register_title(), [
|
||||
msg(),
|
||||
]);
|
||||
}
|
||||
|
||||
if ($request->has('submit')) {
|
||||
$valid = true;
|
||||
|
||||
|
@ -496,7 +504,7 @@ function get_register_hint()
|
|||
{
|
||||
global $privileges;
|
||||
|
||||
if (in_array('register', $privileges)) {
|
||||
if (in_array('register', $privileges) && config('registration_enabled')) {
|
||||
return join('', [
|
||||
'<p>' . _('Please sign up, if you want to help us!') . '</p>',
|
||||
buttons([
|
||||
|
|
|
@ -59,7 +59,7 @@ function header_toolbar()
|
|||
);
|
||||
}
|
||||
|
||||
if (!isset($user) && in_array('register', $privileges)) {
|
||||
if (!isset($user) && in_array('register', $privileges) && config('registration_enabled')) {
|
||||
$toolbar_items[] = toolbar_item_link(page_link_to('register'), 'plus', register_title(), $page == 'register');
|
||||
}
|
||||
|
||||
|
|
|
@ -475,13 +475,27 @@ function AngelTypes_about_view_angeltype($angeltype)
|
|||
*/
|
||||
function AngelTypes_about_view($angeltypes, $user_logged_in)
|
||||
{
|
||||
global $privileges;
|
||||
|
||||
$buttons = [];
|
||||
|
||||
if ($user_logged_in) {
|
||||
$buttons[] = button(page_link_to('angeltypes'), angeltypes_title(), 'back');
|
||||
} else {
|
||||
if (in_array('register', $privileges) && config('registration_enabled')) {
|
||||
$buttons[] = button(page_link_to('register'), register_title());
|
||||
}
|
||||
|
||||
$buttons[] = button(page_link_to('login'), login_title());
|
||||
}
|
||||
|
||||
$faqUrl = config('faq_url');
|
||||
if (!empty($faqUrl)) {
|
||||
$buttons[] = button($faqUrl, _('FAQ'), 'btn-primary');
|
||||
}
|
||||
|
||||
$content = [
|
||||
buttons([
|
||||
!$user_logged_in ? button(page_link_to('register'), register_title()) : '',
|
||||
!$user_logged_in ? button(page_link_to('login'), login_title()) : '',
|
||||
$user_logged_in ? button(page_link_to('angeltypes'), angeltypes_title(), 'back') : '',
|
||||
button(config('faq_url'), _('FAQ'), 'btn-primary')
|
||||
]),
|
||||
buttons($buttons),
|
||||
'<p>' . _('Here is the list of teams and their tasks. If you have questions, read the FAQ.') . '</p>',
|
||||
'<hr />'
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue