mirror of
https://github.com/ramvignesh-b/pi-ku.git
synced 2026-05-04 08:56:52 +00:00
feat: update status code for auth error
This commit is contained in:
+10
-5
@@ -58,11 +58,16 @@ class TokenGenerateView(TokenObtainPairView):
|
|||||||
permission_classes = (permissions.AllowAny,)
|
permission_classes = (permissions.AllowAny,)
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
response = super().post(request, *args, **kwargs)
|
try:
|
||||||
if response.status_code == status.HTTP_200_OK:
|
response = super().post(request, *args, **kwargs)
|
||||||
refresh_token = response.data["refresh"]
|
if response.status_code == status.HTTP_200_OK:
|
||||||
response = set_response_cookies(response, refresh_token)
|
refresh_token = response.data["refresh"]
|
||||||
return response
|
response = set_response_cookies(response, refresh_token)
|
||||||
|
return response
|
||||||
|
except Exception:
|
||||||
|
return Response(
|
||||||
|
{"detail": "No active account found with the given credentials"}, status=status.HTTP_400_BAD_REQUEST
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class RefreshTokenView(TokenRefreshView):
|
class RefreshTokenView(TokenRefreshView):
|
||||||
|
|||||||
Reference in New Issue
Block a user