Allow users to define the LOGIN_URL.

If you rely on a single SSO provider, it can
be confusing for users to see the username/password
login with the SSO provider below. By allowing the
LOGIN_URL to be overwritten users can be redirect
directly to the SSO provider.
This commit is contained in:
Simon Lyngshede 2023-06-26 13:51:34 +02:00
parent d131d9b310
commit 3e13b8b4c4

View File

@ -455,8 +455,11 @@ MESSAGE_TAGS = {
messages.ERROR: 'danger',
}
# Authentication URLs
LOGIN_URL = f'/{BASE_PATH}login/'
# Authentication URLs, if the LOGIN_URL have not been defined in the configuration, default to '/{BASE_PATH}login/'
# Typical usecase for defining the LOGIN_URL will be to redirect to a SSO provider.
if 'LOGIN_URL' not in vars():
LOGIN_URL = f'/{BASE_PATH}login/'
LOGIN_REDIRECT_URL = f'/{BASE_PATH}'
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'