mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2025-02-16 01:40:34 +03:00
Fixed try/catch in logout view
This commit is contained in:
parent
d9b8f3faf6
commit
f3151ad5c0
|
@ -1,5 +1,6 @@
|
||||||
from django.contrib.auth import login, logout
|
from django.contrib.auth import login, logout
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
|
@ -64,7 +65,7 @@ class LogoutView(APIView):
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
try:
|
try:
|
||||||
request.user.auth_token.delete()
|
request.user.auth_token.delete()
|
||||||
except:
|
except (AttributeError, ObjectDoesNotExist):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
logout(request)
|
logout(request)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user