mirror of
https://github.com/krislamo/DJ-BaseSite
synced 2025-09-11 21:49:28 +00:00
First Commit
This commit is contained in:
13
myproject/backends/AuthOverride.py
Normal file
13
myproject/backends/AuthOverride.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from django.contrib.auth.backends import ModelBackend
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
class CaseInsensitiveModelBackend(ModelBackend):
|
||||
def authenticate(self, username=None, password=None):
|
||||
try:
|
||||
user = User.objects.get(username__iexact=username)
|
||||
if user.check_password(password):
|
||||
return user
|
||||
else:
|
||||
return None
|
||||
except User.DoesNotExist:
|
||||
return None
|
0
myproject/backends/__init__.py
Normal file
0
myproject/backends/__init__.py
Normal file
Reference in New Issue
Block a user