From 1229903dcc8def7f0ebec3d07bef72f0568c397a Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Sat, 23 May 2015 19:47:10 +0200 Subject: [PATCH] redirect to login if user do not exists --- cas_server/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cas_server/views.py b/cas_server/views.py index afd5c62..bb7a426 100644 --- a/cas_server/views.py +++ b/cas_server/views.py @@ -58,11 +58,12 @@ def login(request): form = forms.UserCredential(initial={'service':service,'method':method,'warn':request.session.get("warn")}) # if authenticated and successfully renewed authentication if needed - if request.session.get("authenticated") and (not renew or renewed): + if request.session.get("authenticated") request.session.get("username") and (not renew or renewed): try: user = models.User.objects.get(username=request.session["username"]) except models.User.DoesNotExist: _logout(request) + return redirect("login") # if login agains a service is requestest if service: