Reshuffling the Evennia package into the new template paradigm.
This commit is contained in:
parent
2846e64833
commit
2b3a32e447
371 changed files with 17250 additions and 304 deletions
18
lib/web/utils/backends.py
Normal file
18
lib/web/utils/backends.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
from django.contrib.auth.backends import ModelBackend
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
class CaseInsensitiveModelBackend(ModelBackend):
|
||||
"""
|
||||
By default ModelBackend does case _sensitive_ username authentication, which isn't what is
|
||||
generally expected. This backend supports case insensitive username authentication.
|
||||
"""
|
||||
def authenticate(self, username=None, password=None):
|
||||
User = get_user_model()
|
||||
try:
|
||||
user = User.objects.get(username__iexact=username)
|
||||
if user.check_password(password):
|
||||
return user
|
||||
else:
|
||||
return None
|
||||
except User.DoesNotExist:
|
||||
return None
|
||||
Loading…
Add table
Add a link
Reference in a new issue