mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 05:29:17 +02:00
Blacked the code
This commit is contained in:
parent
b6fc0051fa
commit
62ca3bd736
279 changed files with 8861 additions and 9527 deletions
|
@ -16,20 +16,19 @@ class TokenHeaderAuth(BaseJSONWebTokenAuthentication):
|
|||
def get_jwt_value(self, request):
|
||||
|
||||
try:
|
||||
qs = request.get('query_string', b'').decode('utf-8')
|
||||
qs = request.get("query_string", b"").decode("utf-8")
|
||||
parsed = parse_qs(qs)
|
||||
token = parsed['token'][0]
|
||||
token = parsed["token"][0]
|
||||
except KeyError:
|
||||
raise exceptions.AuthenticationFailed('No token')
|
||||
raise exceptions.AuthenticationFailed("No token")
|
||||
|
||||
if not token:
|
||||
raise exceptions.AuthenticationFailed('Empty token')
|
||||
raise exceptions.AuthenticationFailed("Empty token")
|
||||
|
||||
return token
|
||||
|
||||
|
||||
class TokenAuthMiddleware:
|
||||
|
||||
def __init__(self, inner):
|
||||
# Store the ASGI application we were passed
|
||||
self.inner = inner
|
||||
|
@ -41,5 +40,5 @@ class TokenAuthMiddleware:
|
|||
except (User.DoesNotExist, exceptions.AuthenticationFailed):
|
||||
user = AnonymousUser()
|
||||
|
||||
scope['user'] = user
|
||||
scope["user"] = user
|
||||
return self.inner(scope)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue