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
This commit is contained in:
parent
ab967c6f9c
commit
0155a33beb
|
@ -256,6 +256,9 @@ return [
|
||||||
// Users are able to sign up
|
// Users are able to sign up
|
||||||
'registration_enabled' => (bool) env('REGISTRATION_ENABLED', true),
|
'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
|
||||||
'required_user_fields' => [
|
'required_user_fields' => [
|
||||||
'pronoun' => (bool) env('PRONOUN_REQUIRED', false),
|
'pronoun' => (bool) env('PRONOUN_REQUIRED', false),
|
||||||
|
@ -300,9 +303,8 @@ return [
|
||||||
// The minimum length for passwords
|
// The minimum length for passwords
|
||||||
'min_password_length' => env('PASSWORD_MINIMUM_LENGTH', 8),
|
'min_password_length' => env('PASSWORD_MINIMUM_LENGTH', 8),
|
||||||
|
|
||||||
// Whether the Password field should be enabled on registration.
|
// 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
|
// This is useful when using oauth, disabling it also disables normal registration without oauth
|
||||||
// registration without oauth.
|
|
||||||
'enable_password' => (bool) env('ENABLE_PASSWORD', true),
|
'enable_password' => (bool) env('ENABLE_PASSWORD', true),
|
||||||
|
|
||||||
// Whether the DECT field should be enabled
|
// Whether the DECT field should be enabled
|
||||||
|
|
|
@ -360,7 +360,7 @@ ready(() => {
|
||||||
*/
|
*/
|
||||||
ready(() => {
|
ready(() => {
|
||||||
[
|
[
|
||||||
['welcome-title', '.btn-group .btn.d-none'],
|
['welcome-title', '.registration .d-none'],
|
||||||
['settings-title', '.user-settings .nav-item'],
|
['settings-title', '.user-settings .nav-item'],
|
||||||
['oauth-settings-title', 'table tr.d-none'],
|
['oauth-settings-title', 'table tr.d-none'],
|
||||||
].forEach(([id, selector]) => {
|
].forEach(([id, selector]) => {
|
||||||
|
|
|
@ -63,7 +63,12 @@
|
||||||
{% include "layouts/parts/language_dropdown.twig" %}
|
{% include "layouts/parts/language_dropdown.twig" %}
|
||||||
|
|
||||||
{% if has_permission_to('register') and config('registration_enabled') %}
|
{% 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 %}
|
{% endif %}
|
||||||
|
|
||||||
{% if has_permission_to('login') %}
|
{% if has_permission_to('login') %}
|
||||||
|
|
|
@ -15,7 +15,10 @@
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if has_permission_to('register') and config('registration_enabled') %}
|
{% if has_permission_to('register') and config('registration_enabled') %}
|
||||||
<a href="{{ url('/register') }}" class="btn btn-secondary back">
|
<a
|
||||||
|
href="{{ config('external_registration_url') ?: url('/register') }}"
|
||||||
|
class="btn btn-secondary back"
|
||||||
|
>
|
||||||
{{ __('registration.register') }}
|
{{ __('registration.register') }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
|
|
||||||
<div class="row mb-5">
|
<div class="row mb-5">
|
||||||
<div class="col-md-6 offset-md-3 col-lg-4 offset-lg-4">
|
<div class="col-md-6 offset-md-3 col-lg-4 offset-lg-4">
|
||||||
<div class="card {{ m.type_bg_class() }}">
|
<div class="card {{ m.type_bg_class() }} registration">
|
||||||
|
{% set login_hidden = not config('enable_password') %}
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
{% include 'layouts/parts/messages.twig' %}
|
{% include 'layouts/parts/messages.twig' %}
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@
|
||||||
|
|
||||||
<form action="" enctype="multipart/form-data" method="post">
|
<form action="" enctype="multipart/form-data" method="post">
|
||||||
{{ csrf() }}
|
{{ csrf() }}
|
||||||
<div class="mb-3">
|
<div class="mb-3{% if login_hidden %} d-none{% endif %}">
|
||||||
<div class="input-group input-group-lg">
|
<div class="input-group input-group-lg">
|
||||||
<span class="input-group-text {{ m.type_text_class() }}">
|
<span class="input-group-text {{ m.type_text_class() }}">
|
||||||
{{ m.angel }}
|
{{ m.angel }}
|
||||||
|
@ -56,7 +57,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3{% if login_hidden %} d-none{% endif %}">
|
||||||
<div class="input-group input-group-lg">
|
<div class="input-group input-group-lg">
|
||||||
<span class="input-group-text {{ m.type_text_class() }}">
|
<span class="input-group-text {{ m.type_text_class() }}">
|
||||||
<i class="bi bi-key"></i>
|
<i class="bi bi-key"></i>
|
||||||
|
@ -68,7 +69,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3 text-center">
|
<div class="mb-3 text-center{% if login_hidden %} d-none{% endif %}">
|
||||||
<button class="btn btn-primary btn-lg btn-block" type="submit" name="submit">
|
<button class="btn btn-primary btn-lg btn-block" type="submit" name="submit">
|
||||||
{{ __('general.login') }}
|
{{ __('general.login') }}
|
||||||
</button>
|
</button>
|
||||||
|
@ -89,7 +90,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center{% if login_hidden %} d-none{% endif %}">
|
||||||
<a href="{{ url('/password/reset') }}" class="">
|
<a href="{{ url('/password/reset') }}" class="">
|
||||||
{{ __('login.password.reset') }}
|
{{ __('login.password.reset') }}
|
||||||
</a>
|
</a>
|
||||||
|
@ -103,16 +104,20 @@
|
||||||
<div class="row mb-5">
|
<div class="row mb-5">
|
||||||
<div class="col-sm-6 text-center">
|
<div class="col-sm-6 text-center">
|
||||||
<h2>{{ __('general.register') }}</h2>
|
<h2>{{ __('general.register') }}</h2>
|
||||||
{% if has_permission_to('register') and config('registration_enabled') %}
|
{% if
|
||||||
{% if config('enable_password') %}
|
(has_permission_to('register') and config('registration_enabled') and config('enable_password'))
|
||||||
|
or config('external_registration_url') %}
|
||||||
<p>{{ __('login.registration') }}</p>
|
<p>{{ __('login.registration') }}</p>
|
||||||
<a href="{{ url('/register') }}" class="btn btn-primary">{{ __('general.register') }} »</a>
|
|
||||||
|
{% set registration_url = config('external_registration_url') ?: url('/register') %}
|
||||||
|
<a href="{{ registration_url }}" class="btn btn-primary">{{ __('general.register') }} »</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
{% if not config('enable_password') %}
|
||||||
<p>{{ __('login.registration.external') }}</p>
|
<p>{{ __('login.registration.external') }}</p>
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ m.alert(__('login.registration.disabled'), 'danger') }}
|
{{ m.alert(__('login.registration.disabled'), 'danger') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-6 text-center">
|
<div class="col-sm-6 text-center">
|
||||||
|
|
Loading…
Reference in New Issue