Login/Logout redirects with Django variables
The login/logout url patterns now use
the Django LOGIN_URL and LOGOUT_URL
The default redirect url after a successful login
now uses as default the Django LOGIN_REDIRECT_URL
with possible override using HORIZON_CONFIG.user_home
in settings file. There are 3 cases:
* no user_home in settings.HORIZON_CONFIG - uses
Django LOGIN_REDIRECT_URL
* user_home = None in settings.HORIZON_CONFIG -
will default to the primary dashboard(the current
fall-back behavior)
* user_home = 'something' - it will be used to
determine the actual redirect url
Fixes bug 980434
Patch Set 2:
Restored the previous behavior - splash page('/')
redirects to /nova or /syspanel, depending on the user,
while /home/ will redirect to the 'user_home' setting
(or LOGIN_REDIRECT_URL if user_home is not set).
The same logic will be applied after user logs in.
Change-Id: I28e25566199393382639da9ca2022d1850f25a94
This commit is contained in:
@@ -52,7 +52,8 @@ HORIZON_CONFIG = {
|
||||
'dashboards': None,
|
||||
# Name of a default dashboard; defaults to first alphabetically if None
|
||||
'default_dashboard': None,
|
||||
'user_home': None,
|
||||
# Default redirect url for users' home
|
||||
'user_home': settings.LOGIN_REDIRECT_URL,
|
||||
'exceptions': {'unauthorized': [],
|
||||
'not_found': [],
|
||||
'recoverable': []}
|
||||
@@ -700,9 +701,11 @@ class Site(Registry, HorizonComponent):
|
||||
{"user_home": "/home",} # A URL
|
||||
{"user_home": "my_module.get_user_home",} # Path to a function
|
||||
{"user_home": lambda user: "/" + user.name,} # A function
|
||||
{"user_home": None,} # Will always return the default dashboard
|
||||
|
||||
This can be useful if the default dashboard may not be accessible
|
||||
to all users.
|
||||
to all users. When user_home is missing from HORIZON_CONFIG,
|
||||
it will default to the settings.LOGIN_REDIRECT_URL value.
|
||||
"""
|
||||
user_home = self._conf['user_home']
|
||||
if user_home:
|
||||
|
||||
Reference in New Issue
Block a user