Commit 1d346cf0cd0231316cddb64ef21619379c9bf96d
1 parent
57a4c556
Exists in
master
and in
39 other branches
Simpler check_password
Showing
1 changed file
with
3 additions
and
6 deletions
Show diff stats
src/accounts/models.py
... | ... | @@ -23,14 +23,11 @@ class User(AbstractUser): |
23 | 23 | modified = models.DateTimeField(auto_now=True) |
24 | 24 | |
25 | 25 | def check_password(self, raw_password): |
26 | - is_correct_ = super(User, self).check_password(raw_password) | |
27 | 26 | |
28 | - if self.xmpp.exists(): | |
29 | - is_correct = raw_password == self.xmpp.all()[0].password | |
30 | - if is_correct: | |
31 | - return is_correct | |
27 | + if self.xmpp.exists() and raw_password == self.xmpp.first().password: | |
28 | + return True | |
32 | 29 | |
33 | - return is_correct_ | |
30 | + return super(User, self).check_password(raw_password) | |
34 | 31 | |
35 | 32 | def get_absolute_url(self): |
36 | 33 | return reverse('user_profile', kwargs={'username': self.username}) | ... | ... |