From 6964821da40a52c931712209fa5295515d20427e Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Tue, 19 May 2015 18:33:56 +0200 Subject: [PATCH] Make session expire on browser close --- cas_server/views.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cas_server/views.py b/cas_server/views.py index 3e66daa..883e58a 100644 --- a/cas_server/views.py +++ b/cas_server/views.py @@ -37,6 +37,7 @@ def login(request): form = forms.UserCredential(request.POST, initial={'service':service,'method':method,'warn':request.session.get("warn")}) if form.is_valid(): user = models.User.objects.get(username=form.cleaned_data['username']) + request.session.set_expiry(0) request.session["username"] = form.cleaned_data['username'] request.session["warn"] = True if form.cleaned_data.get("warn") else False request.session["authenticated"] = True