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:
parent
4c3d12dbdb
commit
e940196a43
@ -39,7 +39,7 @@ def add_logout_reason(request, response, reason):
|
|||||||
lang = translation.get_language_from_request(request)
|
lang = translation.get_language_from_request(request)
|
||||||
with translation.override(lang):
|
with translation.override(lang):
|
||||||
reason = unicode(reason).encode('utf-8')
|
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):
|
def logout_with_message(request, msg):
|
||||||
|
@ -38,8 +38,11 @@ def get_user_home(user):
|
|||||||
@django.views.decorators.vary.vary_on_cookie
|
@django.views.decorators.vary.vary_on_cookie
|
||||||
def splash(request):
|
def splash(request):
|
||||||
if request.user.is_authenticated():
|
if request.user.is_authenticated():
|
||||||
return shortcuts.redirect(horizon.get_user_home(request.user))
|
response = shortcuts.redirect(horizon.get_user_home(request.user))
|
||||||
form = forms.Login(request)
|
else:
|
||||||
request.session.clear()
|
form = forms.Login(request)
|
||||||
request.session.set_test_cookie()
|
request.session.clear()
|
||||||
return shortcuts.render(request, 'splash.html', {'form': form})
|
request.session.set_test_cookie()
|
||||||
|
response = shortcuts.render(request, 'splash.html', {'form': form})
|
||||||
|
response.delete_cookie('logout_reason')
|
||||||
|
return response
|
||||||
|
Loading…
Reference in New Issue
Block a user