huge updates

This commit is contained in:
sankalp committed 2025-04-03 16:30:28 +05:45
1 parent 861d64c95a
commit ee89d38489
56 files changed
+10130 -4185

No files matched your search

+12 -18
View File
@@ -11,28 +11,22 @@ class MultiModelBackend(ModelBackend):
return None
# Try authenticating as Staff by phone
try:
staff = Staff.objects.get(phone=username)
if staff.check_password(password):
return staff
except Staff.DoesNotExist:
pass
# Use filter().first() to avoid MultipleObjectsReturned error
staff = Staff.objects.filter(phone=username).first()
if staff and staff.check_password(password):
return staff
# Try authenticating as Staff by email
try:
staff = Staff.objects.get(email=username)
if staff.check_password(password):
return staff
except Staff.DoesNotExist:
pass
# Use filter().first() to avoid MultipleObjectsReturned error
staff = Staff.objects.filter(email=username).first()
if staff and staff.check_password(password):
return staff
# Try authenticating as Student by phone
try:
student = Student.objects.get(phone=username)
if student.check_password(password):
return student
except Student.DoesNotExist:
pass
# Use filter().first() to avoid MultipleObjectsReturned error
student = Student.objects.filter(phone=username).first()
if student and student.check_password(password):
return student
# Try authenticating as Student by email
# Use filter().first() to handle multiple students with same email