From 1d346cf0cd0231316cddb64ef21619379c9bf96d Mon Sep 17 00:00:00 2001 From: Sergio Oliveira Date: Thu, 28 Nov 2013 11:12:44 -0200 Subject: [PATCH] Simpler check_password --- src/accounts/models.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/accounts/models.py b/src/accounts/models.py index aece67c..1a77a12 100644 --- a/src/accounts/models.py +++ b/src/accounts/models.py @@ -23,14 +23,11 @@ class User(AbstractUser): modified = models.DateTimeField(auto_now=True) def check_password(self, raw_password): - is_correct_ = super(User, self).check_password(raw_password) - if self.xmpp.exists(): - is_correct = raw_password == self.xmpp.all()[0].password - if is_correct: - return is_correct + if self.xmpp.exists() and raw_password == self.xmpp.first().password: + return True - return is_correct_ + return super(User, self).check_password(raw_password) def get_absolute_url(self): return reverse('user_profile', kwargs={'username': self.username}) -- libgit2 0.21.2