1
This commit is contained in:
@@ -67,16 +67,10 @@ class JWTAuthentication(BaseAuthentication):
|
||||
try:
|
||||
account = Account.objects.get(id=account_id)
|
||||
except Account.DoesNotExist:
|
||||
pass
|
||||
|
||||
if not account:
|
||||
try:
|
||||
account = getattr(user, 'account', None)
|
||||
except (AttributeError, Exception):
|
||||
# If account access fails, set to None
|
||||
# Account from token doesn't exist - don't fallback, set to None
|
||||
account = None
|
||||
|
||||
# Set account on request
|
||||
# Set account on request (only if account_id was in token and account exists)
|
||||
request.account = account
|
||||
|
||||
return (user, token)
|
||||
|
||||
Reference in New Issue
Block a user