From 8e21931cf2428583aaecafda651ed105baccccd4 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Sat, 23 May 2015 19:43:21 +0200 Subject: [PATCH] Warn if warn user session variable is not defined --- cas_server/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cas_server/views.py b/cas_server/views.py index 0f73cf9..afd5c62 100644 --- a/cas_server/views.py +++ b/cas_server/views.py @@ -72,7 +72,7 @@ def login(request): # is the current user allowed on this service service_pattern.check_user(user) # if the user has asked to be warned before any login to a service (no transparent SSO) - if request.session["warn"] and not warned: + if request.session.get("warn", True) and not warned: messages.add_message(request, messages.WARNING, _(u"Authentication has been required by service %(name)s (%(url)s)") % {'name':service_pattern.name, 'url':service}) return render(request, settings.CAS_WARN_TEMPLATE, {'service_ticket_url':user.get_service_url(service, service_pattern, renew=renew)}) else: