]>
git.frykholm.com Git - tranquillity.git/blob - tranquillity/auth_backend.py
44edaeebb9d25163ad65d7883141dc2b30a582af
1 from django
.contrib
.auth
import get_user_model
2 from django
.contrib
.auth
.backends
import ModelBackend
4 class EmailBackend(ModelBackend
):
5 def authenticate(self
, username
=None, password
=None, **kwargs
):
6 UserModel
= get_user_model()
8 user
= UserModel
.objects
.get(email
=username
)
9 except UserModel
.DoesNotExist
:
12 if user
.check_password(password
):