Added updatePassword view, added exception handler, added friends view

This commit is contained in:
ITQ
2024-03-03 18:13:59 +03:00
parent 18f66344bb
commit 20e6e512d2
9 changed files with 169 additions and 57 deletions
+4 -6
View File
@@ -15,15 +15,13 @@ class JWTAuthentication(BaseAuthentication):
return "Provide a valid token in the 'Authorization' header"
def authenticate(self, request):
if not IsAuthenticated in getattr(request.resolver_match.func.cls, "permission_classes", []):
return None
token = request.headers.get("Authorization", "").split("Bearer ")[-1]
if not token:
if IsAuthenticated in getattr(
request.resolver_match.func.cls, "permission_classes", []
):
raise NotAuthenticated
return None
raise NotAuthenticated
try:
payload = jwt.decode(