From 3e13b8b4c4de32435fb2746d73bc4108d79c29a0 Mon Sep 17 00:00:00 2001 From: Simon Lyngshede Date: Mon, 26 Jun 2023 13:51:34 +0200 Subject: [PATCH] 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. --- netbox/netbox/settings.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 31363144f..48d75e635 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -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'