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