fix API token_auth and CSRF setup

This commit is contained in:
Nick Sweeting 2024-09-03 01:21:13 -07:00
parent 9af260df16
commit c1c55d6da7
No known key found for this signature in database
2 changed files with 12 additions and 5 deletions

View file

@ -30,8 +30,8 @@ def auth_using_token(token, request: Optional[HttpRequest]=None) -> Optional[Abs
if not user:
print('[❌] Failed to authenticate API user using API Key:', request)
return None
return None
return cast(AbstractBaseUser, user)
def auth_using_password(username, password, request: Optional[HttpRequest]=None) -> Optional[AbstractBaseUser]:
"""Given a username and password, check if they are valid and return the corresponding user"""