

def authenticate(self, username=None, password=None):
    try:
        kwargs = {
            'email': username,
        }
        user = User.objects.get(**kwargs)
    except:
        kwargs = {
            'username': username,
        }
        user = User.objects.get(**kwargs)
    finally:
        try:
            if user.check_password(password):
                return user
        except:
            User.set_password(password)
            return None

dataset/ETHPy150Open haystack/eyebrowse-server/eyebrowse/backends.py EmailOrUsernameBackend.authenticate/original