From 365cfd4279b220978dabbbfd6cf64dca3b1cbe00 Mon Sep 17 00:00:00 2001 From: Valentin Samir Date: Thu, 11 Jun 2015 23:34:25 +0200 Subject: [PATCH] oops --- cas_server/forms.py | 4 ++-- cas_server/models.py | 5 +---- cas_server/views.py | 8 ++++---- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/cas_server/forms.py b/cas_server/forms.py index ef12873..29c66cf 100644 --- a/cas_server/forms.py +++ b/cas_server/forms.py @@ -37,13 +37,13 @@ class UserCredential(forms.Form): try: user = models.User.objects.get( username=auth.username, - session_key=self.request.session_key + session_key=self.request.session.session_key ) user.save() except models.User.DoesNotExist: user = models.User.objects.create( username=auth.username, - session_key=self.request.session_key + session_key=self.request.session.session_key ) user.save() else: diff --git a/cas_server/models.py b/cas_server/models.py index 75d4814..8da3b2e 100644 --- a/cas_server/models.py +++ b/cas_server/models.py @@ -61,10 +61,7 @@ class User(models.Model): return utils.import_attr(settings.CAS_AUTH_CLASS)(self.username).attributs() def __unicode__(self): - if self.session: - return u"%s - %s" % (self.username, self.session.session_key) - else: - return self.username + return u"%s - %s" % (self.username, self.session_key) def logout(self, request=None): """Sending SLO request to all services the user logged in""" diff --git a/cas_server/views.py b/cas_server/views.py index 8a396ee..eb1a65e 100644 --- a/cas_server/views.py +++ b/cas_server/views.py @@ -71,7 +71,7 @@ class LogoutMixin(object): try: user = models.User.objects.get( username=self.request.session.get("username"), - session_key=self.request.session_key + session_key=self.request.session.session_key ) user.logout(self.request) user.delete() @@ -156,7 +156,7 @@ class LoginView(View, LogoutMixin): if self.form.is_valid(): self.user = models.User.objects.get( username=self.form.cleaned_data['username'], - session_key=self.request.session_key + session_key=self.request.session.session_key ) request.session.set_expiry(0) request.session["username"] = self.form.cleaned_data['username'] @@ -263,7 +263,7 @@ class LoginView(View, LogoutMixin): try: self.user = models.User.objects.get( username=self.request.session.get("username"), - session_key=self.request.session_key + session_key=self.request.session.session_key ) except models.User.DoesNotExist: self.logout() @@ -351,7 +351,7 @@ class Auth(View): try: user = models.User.objects.get( username=form.cleaned_data['username'], - session_key=self.request.session_key + session_key=self.request.session.session_key ) # is the service allowed service_pattern = ServicePattern.validate(service)