🔧 chore(apps): update app names and structures in various files
This commit is contained in:
27 files changed
+588
-45
No files matched your search
@@ -0,0 +1,17 @@
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.backends import ModelBackend
|
||||
from django.db.models import Q
|
||||
|
||||
UserModel = get_user_model()
|
||||
|
||||
|
||||
class EmailOrPhoneBackend(ModelBackend):
|
||||
def authenticate(self, request, username=None, password=None, **kwargs):
|
||||
try:
|
||||
user = UserModel.objects.get(Q(email=username) | Q(phone=username))
|
||||
except UserModel.DoesNotExist:
|
||||
return None
|
||||
|
||||
if user.check_password(password) and self.user_can_authenticate(user):
|
||||
return user
|
||||
return None
|
||||
Reference in new issue
Block a user