mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2025-07-22 05:29:46 +03:00
Fix Logout Anonymous User
Insert a proper response when the user is anonymous on the logout view Fixes https://github.com/Tivix/django-rest-auth/issues/332
This commit is contained in:
parent
9d1f65eedc
commit
9dfb2dc49e
|
@ -119,7 +119,8 @@ class LogoutView(APIView):
|
|||
try:
|
||||
request.user.auth_token.delete()
|
||||
except (AttributeError, ObjectDoesNotExist):
|
||||
pass
|
||||
return Response({"detail": _("Cannot log out Anonymous User")},
|
||||
status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
django_logout(request)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user