Update authentication backend to be django 2 compatible

This commit is contained in:
Magnus Hagander
2020-03-31 23:40:32 +02:00
parent 189a0815df
commit 46a76146bd

View File

@ -5,7 +5,7 @@ from django.contrib.auth.backends import ModelBackend
# Special version of the authentication backend, so we can handle things like # Special version of the authentication backend, so we can handle things like
# forced lowercasing of usernames. # forced lowercasing of usernames.
class AuthBackend(ModelBackend): class AuthBackend(ModelBackend):
def authenticate(self, username=None, password=None): def authenticate(self, request, username=None, password=None):
try: try:
# We don't allow @ signs in usernames (see accounts/forms.py), so if there is one # We don't allow @ signs in usernames (see accounts/forms.py), so if there is one
# specified then the user is clearly trying to log in with an email address, # specified then the user is clearly trying to log in with an email address,