settings: Allow customizing HOME_NOT_LOGGED_IN.

This can be useful if one wants a third-party authentication system to
apply first.
This commit is contained in:
Tim Abbott
2022-05-08 19:53:19 -07:00
committed by Alex Vandiver
parent 7e9b1a13b0
commit 0255cbda03
3 changed files with 11 additions and 9 deletions

View File

@@ -38,6 +38,7 @@ from .configured_settings import (
EXTERNAL_URI_SCHEME,
EXTRA_INSTALLED_APPS,
GOOGLE_OAUTH2_CLIENT_ID,
HOME_NOT_LOGGED_IN,
INVITATION_LINK_VALIDITY_DAYS,
IS_DEV_DROPLET,
LOCAL_UPLOADS_DIR,
@@ -1038,18 +1039,14 @@ ONLY_LDAP = AUTHENTICATION_BACKENDS == ("zproject.backends.ZulipLDAPAuthBackend"
USING_APACHE_SSO = "zproject.backends.ZulipRemoteUserBackend" in AUTHENTICATION_BACKENDS
ONLY_SSO = AUTHENTICATION_BACKENDS == ("zproject.backends.ZulipRemoteUserBackend",)
if ONLY_SSO:
HOME_NOT_LOGGED_IN = "/accounts/login/sso/"
else:
HOME_NOT_LOGGED_IN = "/login/"
if HOME_NOT_LOGGED_IN is None:
if ONLY_SSO:
HOME_NOT_LOGGED_IN = "/accounts/login/sso/"
else:
HOME_NOT_LOGGED_IN = "/login/"
AUTHENTICATION_BACKENDS += ("zproject.backends.ZulipDummyBackend",)
# Redirect to /devlogin/ by default in dev mode
if DEVELOPMENT:
HOME_NOT_LOGGED_IN = "/devlogin/"
LOGIN_URL = "/devlogin/"
POPULATE_PROFILE_VIA_LDAP = bool(AUTH_LDAP_SERVER_URI)
if POPULATE_PROFILE_VIA_LDAP and not USING_LDAP: