Revision 8fb8d0cf snf-astakos-app/astakos/im/auth_backends.py
b/snf-astakos-app/astakos/im/auth_backends.py | ||
---|---|---|
48 | 48 |
def authenticate(self, email=None, auth_token=None): |
49 | 49 |
try: |
50 | 50 |
user = AstakosUser.objects.get_by_identifier(email, is_active=True, |
51 |
auth_token=auth_token) |
|
51 |
auth_token=auth_token)
|
|
52 | 52 |
return user |
53 | 53 |
except AstakosUser.DoesNotExist: |
54 | 54 |
return None |
... | ... | |
65 | 65 |
|
66 | 66 |
class EmailBackend(ModelBackend): |
67 | 67 |
""" |
68 |
If the ``username`` parameter is actually an email uses email to authenticate
|
|
69 |
the user else tries the username. |
|
68 |
If the ``username`` parameter is actually an email uses email to |
|
69 |
authenticate the user else tries the username.
|
|
70 | 70 |
|
71 | 71 |
Used from ``astakos.im.forms.LoginForm`` to authenticate. |
72 | 72 |
""" |
... | ... | |
83 | 83 |
msg = 'Invalid password during authentication for %s' % username |
84 | 84 |
logger._log(settings.LOGGING_LEVEL, msg, []) |
85 | 85 |
|
86 |
|
|
87 | 86 |
def get_user(self, user_id): |
88 | 87 |
try: |
89 | 88 |
return AstakosUser.objects.get(pk=user_id) |
Also available in: Unified diff