Fixed an issue with the backend authentication not getting the proper user model.
This commit is contained in:
parent
da097a88d9
commit
083642b2dd
1 changed files with 2 additions and 1 deletions
|
|
@ -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):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue