diff options
author | nikunj2512 <nikunj.aggarwal@hp.com> | 2014-06-18 16:34:59 +0530 |
---|---|---|
committer | nikunj2512 <nikunj.aggarwal@hp.com> | 2014-09-24 10:23:40 +0530 |
commit | e940196a4386d51f9a9c2644cea28940da48f08b (patch) | |
tree | 17be6ca4656c495e8ebf4ac322e4f178fa39e3fc | |
parent | 4c3d12dbdb6848173bd0447a28b6122ff0b7be70 (diff) | |
download | horizon-e940196a4386d51f9a9c2644cea28940da48f08b.tar.gz |
Fixes session timeout string in horizon
1) This patch fixes the session timeout string problem which
occurs when users clicks on the UI and Ui redirects the
user to the login page but without session timeout message.
2) This patch also fixes other cases of unnecessary logout
messages.
Closes-Bug: #1231355
Change-Id: I9824db44382247d64cc8c399eb5e855e818e8781
-rw-r--r-- | horizon/utils/functions.py | 2 | ||||
-rw-r--r-- | openstack_dashboard/views.py | 13 |
2 files changed, 9 insertions, 6 deletions
diff --git a/horizon/utils/functions.py b/horizon/utils/functions.py index 3d3836614..85802f53e 100644 --- a/horizon/utils/functions.py +++ b/horizon/utils/functions.py @@ -39,7 +39,7 @@ def add_logout_reason(request, response, reason): lang = translation.get_language_from_request(request) with translation.override(lang): reason = unicode(reason).encode('utf-8') - response.set_cookie('logout_reason', reason, max_age=30) + response.set_cookie('logout_reason', reason, max_age=10) def logout_with_message(request, msg): diff --git a/openstack_dashboard/views.py b/openstack_dashboard/views.py index a5e85c528..4ce55ffdc 100644 --- a/openstack_dashboard/views.py +++ b/openstack_dashboard/views.py @@ -38,8 +38,11 @@ def get_user_home(user): @django.views.decorators.vary.vary_on_cookie def splash(request): if request.user.is_authenticated(): - return shortcuts.redirect(horizon.get_user_home(request.user)) - form = forms.Login(request) - request.session.clear() - request.session.set_test_cookie() - return shortcuts.render(request, 'splash.html', {'form': form}) + response = shortcuts.redirect(horizon.get_user_home(request.user)) + else: + form = forms.Login(request) + request.session.clear() + request.session.set_test_cookie() + response = shortcuts.render(request, 'splash.html', {'form': form}) + response.delete_cookie('logout_reason') + return response |