mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 15:19:15 +02:00
Fixed 500 error in authentication
This commit is contained in:
parent
3753193c10
commit
e4c044638b
1 changed files with 2 additions and 1 deletions
|
@ -9,6 +9,7 @@ from rest_framework import exceptions
|
|||
from rest_framework_jwt.settings import api_settings
|
||||
from rest_framework_jwt.authentication import BaseJSONWebTokenAuthentication
|
||||
|
||||
from funkwhale_api.users.models import User
|
||||
|
||||
|
||||
class TokenHeaderAuth(BaseJSONWebTokenAuthentication):
|
||||
|
@ -40,7 +41,7 @@ class TokenAuthMiddleware:
|
|||
auth = TokenHeaderAuth()
|
||||
try:
|
||||
user, token = auth.authenticate(scope)
|
||||
except exceptions.AuthenticationFailed:
|
||||
except (User.DoesNotExist, exceptions.AuthenticationFailed):
|
||||
user = AnonymousUser()
|
||||
|
||||
scope['user'] = user
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue