login, logout and login redirect urls arn't set using standard django variables

Bug #980434 reported by Russell Sim
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Wishlist
Tihomir Trifonov

Bug Description

Currently in horizon login, logout, and redirect are bound to horizon:auth_login, horizon:auth_logout, using the HORIZON_CONFIG['user_home'] respectively.

This means that if you want to override the login URL you can't without overriding the /auth/login URL regex in the urlpatterns or subclass the HorizonMiddleware. The auth_logout URL also needs to be overridden using URL regular expression. And If I integrate an existing Django application I will be required to set the LOGIN_URL and LOGOUT_URL because in Django they are by default set to /accounts/log(in|out)

Similarly Django already provides a mechanism for setting the URL that a user is redirected to after login, so If I provide an alternative auth whilst keeping the standard auth enabled, I am required to set both HORIZON_CONFIG['user_home'] and LOGIN_REDIRECT_URL.

Django provides 3 variables that are used to handle login, logout and where the user is redirected to after login. Would it be possible to for Horizon to use Django standard variables LOGIN_URL [1], LOGOUT_URL [2] and LOGIN_REDIRECT_URL [3] instead of the hardcoded auth and the non-standard redirect URLs?

1. https://docs.djangoproject.com/en/1.3/ref/settings/#login-url
2. https://docs.djangoproject.com/en/1.3/ref/settings/#logout-url
3. https://docs.djangoproject.com/en/1.3/ref/settings/#login-redirect-url

Devin Carlen (devcamcar)
Changed in horizon:
status: New → Confirmed
importance: Undecided → Wishlist
milestone: none → folsom-1
Devin Carlen (devcamcar)
Changed in horizon:
assignee: nobody → Nebula (nebula)
Devin Carlen (devcamcar)
Changed in horizon:
milestone: folsom-1 → folsom-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/8723

Changed in horizon:
assignee: Nebula (nebula) → Tihomir Trifonov (ttrifonov)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/8723
Committed: http://github.com/openstack/horizon/commit/f0fe2029f3ee9ad36ad3fa972610de7669115ca6
Submitter: Jenkins
Branch: master

commit f0fe2029f3ee9ad36ad3fa972610de7669115ca6
Author: Tihomir Trifonov <email address hidden>
Date: Wed Jun 20 00:05:08 2012 +0300

    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

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: folsom-2 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.