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
This commit is contained in:
nikunj2512 2014-06-18 16:34:59 +05:30
parent 4c3d12dbdb
commit e940196a43
2 changed files with 9 additions and 6 deletions

View File

@ -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):

View File

@ -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))
response = shortcuts.redirect(horizon.get_user_home(request.user))
else:
form = forms.Login(request)
request.session.clear()
request.session.set_test_cookie()
return shortcuts.render(request, 'splash.html', {'form': form})
response = shortcuts.render(request, 'splash.html', {'form': form})
response.delete_cookie('logout_reason')
return response