Added me/profile page and small improvements

This commit is contained in:
ITQ
2024-02-29 22:47:48 +03:00
parent 2ea64e2bcb
commit a8c63e223a
5 changed files with 32 additions and 16 deletions
+8 -5
View File
@@ -19,11 +19,14 @@ class JWTAuthentication(BaseAuthentication):
)
user = Profile.objects.get(login=payload["login"])
return (user, None)
except Profile.DoesNotExist:
raise AuthenticationFailed("Invalid token")
error = "Invalid token"
raise AuthenticationFailed(error) from None
except jwt.ExpiredSignatureError:
raise AuthenticationFailed("Token has expired")
error = "Token has expired"
raise AuthenticationFailed(error) from None
except jwt.InvalidTokenError:
raise AuthenticationFailed("Invalid token")
error = "Invalid token"
raise AuthenticationFailed(error) from None
else:
return (user, None)