summaryrefslogtreecommitdiff
path: root/horizon/middleware.py
diff options
context:
space:
mode:
Diffstat (limited to 'horizon/middleware.py')
-rw-r--r--horizon/middleware.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/horizon/middleware.py b/horizon/middleware.py
index 885489e5c..d39f4da26 100644
--- a/horizon/middleware.py
+++ b/horizon/middleware.py
@@ -158,6 +158,12 @@ class HorizonMiddleware(object):
login_url = request.build_absolute_uri(auth_url)
response = redirect_to_login(next_url, login_url=login_url,
redirect_field_name=field_name)
+ if isinstance(exception, exceptions.NotAuthorized):
+ logout_reason = _("Unauthorized. Please try logging in again.")
+ utils.add_logout_reason(request, response, logout_reason)
+ # delete messages, created in get_data() method
+ # since we are going to redirect user to the login page
+ response.delete_cookie('messages')
if request.is_ajax():
response_401 = http.HttpResponse(status=401)