Fixed placement of websocket javascript and template.

Fixed wrong readme in static.

Moved backends.py into web/util
This commit is contained in:
Kelketek Rritaa 2014-06-29 07:05:45 -05:00
parent a1b596a847
commit a34ddea236
6 changed files with 8 additions and 9 deletions

18
src/web/utils/backends.py Normal file
View 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