Fixed an issue with the backend authentication not getting the proper user model.

This commit is contained in:
Kelketek 2013-07-19 17:22:46 -05:00
parent da097a88d9
commit 083642b2dd

View file

@ -1,5 +1,5 @@
from django.contrib.auth.backends import ModelBackend from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User from django.contrib.auth import get_user_model
class CaseInsensitiveModelBackend(ModelBackend): class CaseInsensitiveModelBackend(ModelBackend):
""" """
@ -7,6 +7,7 @@ class CaseInsensitiveModelBackend(ModelBackend):
generally expected. This backend supports case insensitive username authentication. generally expected. This backend supports case insensitive username authentication.
""" """
def authenticate(self, username=None, password=None): def authenticate(self, username=None, password=None):
User = get_user_model()
try: try:
user = User.objects.get(username__iexact=username) user = User.objects.get(username__iexact=username)
if user.check_password(password): if user.check_password(password):