3e0f69da75
Shows a warning messages to users who try to access restricted page. This bug can be simply fixed in middleware.py: if isinstance(exception, (exceptions.NotAuthorized, exceptions.NotAuthenticated)): if request.user.is_authenticated() and 'next' in request.GET: # a logged-in users gets NotAuthorized exception, # then just redirect to user_home instead of '?next=' But in the case when an user uses different logins(e.g for different projects), and wants to switch fast between them, trying to load an admin-only(or other restricted) page, then Dashboard will redirect them to their home page, and the user will have to sign-out first, then login again and load the desired page. With this fix however, the user will see a message, giving them a choice to login as different user, or to go to their 'home page' if they landed on the restricted page by error, allowing fast-switching between multiple accounts. Also, this will work fine with bookmarked pages. P.S. The html repr of the error message will probably need some improvements... Fixes bug 1053698 Change-Id: Id458af6c7bd90081fc95d339b32a3654878a927d
44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
|
|
# Copyright 2012 United States Government as represented by the
|
|
# Administrator of the National Aeronautics and Space Administration.
|
|
# All Rights Reserved.
|
|
#
|
|
# Copyright 2012 Nebula, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
"""
|
|
URL patterns for testing Horizon views.
|
|
"""
|
|
|
|
from django.conf.urls.defaults import patterns, url, include
|
|
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
|
from django.views.generic import TemplateView
|
|
|
|
import horizon
|
|
|
|
|
|
urlpatterns = patterns('',
|
|
url(r'', include(horizon.urls)),
|
|
url(r"auth/login/", "django.contrib.auth.views.login",
|
|
{'template_name': "auth/login.html"},
|
|
name='login'),
|
|
url(r'auth/', include('django.contrib.auth.urls')),
|
|
url(r'^qunit/$',
|
|
TemplateView.as_view(template_name="horizon/qunit.html"),
|
|
name='qunit_tests')
|
|
)
|
|
|
|
urlpatterns += staticfiles_urlpatterns()
|