Commit 0166f5bf authored by Jean-samuel TETTEKPOE's avatar Jean-samuel TETTEKPOE
Browse files

Fix old auth

parent f994cbd6
Pipeline #9131 failed with stage
in 37 seconds
from django.utils import timezone
from bars_core.models.user import User
from django.contrib.auth.backends import BaseBackend
class AuthenticationBackend(object):
def authenticate(self, username=None, password=None):
class AuthenticationBackend(BaseBackend):
def authenticate(self, request, username=None, password=None):
if username is None or password is None:
user = User.objects.get(username=username)
user = User.objects.get_by_natural_key(username)
if user.check_password(password):
return user
except User.DoesNotExist:
return None
# Run the default password hasher once to reduce the timing
# difference between an existing and a nonexistent user (#20760).
def get_user(self, user_id):
......@@ -142,8 +142,7 @@ REST_FRAMEWORK = {
import datetime
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment