From 0155a33beb237b8c27c042f2ffe7d69827d4f893 Mon Sep 17 00:00:00 2001 From: Daniel Poelzleithner Date: Fri, 4 Aug 2023 01:27:38 +0200 Subject: [PATCH] Add external_register_url to link to external registration site, hide password form if enable_password is false Our users have problems with the disabled register button and keep creating tickets. Add option to link to external site instead of a disabled button. People get confused by the login form if they should only use the oauth login. Now the login form is hidden if enable_password is false. It can be shown by clicking the welcome text, in case an admin needs access --- config/config.default.php | 8 ++++-- resources/assets/js/forms.js | 2 +- resources/views/layouts/parts/navbar.twig | 7 ++++- resources/views/pages/angeltypes/about.twig | 5 +++- resources/views/pages/login.twig | 31 ++++++++++++--------- 5 files changed, 34 insertions(+), 19 deletions(-) diff --git a/config/config.default.php b/config/config.default.php index 8e0cb314..177fd70d 100644 --- a/config/config.default.php +++ b/config/config.default.php @@ -256,6 +256,9 @@ return [ // Users are able to sign up 'registration_enabled' => (bool) env('REGISTRATION_ENABLED', true), + // URL to external registration page, used on login page + 'external_registration_url' => env('EXTERNAL_REGISTRATION_URL'), + // Required user fields 'required_user_fields' => [ 'pronoun' => (bool) env('PRONOUN_REQUIRED', false), @@ -300,9 +303,8 @@ return [ // The minimum length for passwords 'min_password_length' => env('PASSWORD_MINIMUM_LENGTH', 8), - // Whether the Password field should be enabled on registration. - // This is useful when using oauth, disabling it also disables normal - // registration without oauth. + // Whether the login and registration via password should be enabled (login will be hidden) + // This is useful when using oauth, disabling it also disables normal registration without oauth 'enable_password' => (bool) env('ENABLE_PASSWORD', true), // Whether the DECT field should be enabled diff --git a/resources/assets/js/forms.js b/resources/assets/js/forms.js index 260f6347..0d853d29 100644 --- a/resources/assets/js/forms.js +++ b/resources/assets/js/forms.js @@ -360,7 +360,7 @@ ready(() => { */ ready(() => { [ - ['welcome-title', '.btn-group .btn.d-none'], + ['welcome-title', '.registration .d-none'], ['settings-title', '.user-settings .nav-item'], ['oauth-settings-title', 'table tr.d-none'], ].forEach(([id, selector]) => { diff --git a/resources/views/layouts/parts/navbar.twig b/resources/views/layouts/parts/navbar.twig index ff776a07..455ca7e2 100644 --- a/resources/views/layouts/parts/navbar.twig +++ b/resources/views/layouts/parts/navbar.twig @@ -63,7 +63,12 @@ {% include "layouts/parts/language_dropdown.twig" %} {% if has_permission_to('register') and config('registration_enabled') %} - {{ _self.toolbar_item(__('general.register'), url('/register'), 'register', 'plus') }} + {{ _self.toolbar_item( + __('general.register'), + config('external_registration_url') ?: url('/register'), + 'register', + 'plus' + ) }} {% endif %} {% if has_permission_to('login') %} diff --git a/resources/views/pages/angeltypes/about.twig b/resources/views/pages/angeltypes/about.twig index 74dbe46f..02979af8 100644 --- a/resources/views/pages/angeltypes/about.twig +++ b/resources/views/pages/angeltypes/about.twig @@ -15,7 +15,10 @@ {% else %} {% if has_permission_to('register') and config('registration_enabled') %} - + {{ __('registration.register') }} {% endif %} diff --git a/resources/views/pages/login.twig b/resources/views/pages/login.twig index b09117a0..33de9f4c 100644 --- a/resources/views/pages/login.twig +++ b/resources/views/pages/login.twig @@ -30,7 +30,8 @@
-
+
+ {% set login_hidden = not config('enable_password') %}
{% include 'layouts/parts/messages.twig' %} @@ -40,7 +41,7 @@
{{ csrf() }} -
+ -
+ -
+ {% endif %} -
+