Skip to content

Commit f3151ad

Browse files
committed
Fixed try/catch in logout view
1 parent d9b8f3f commit f3151ad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rest_auth/views.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from django.contrib.auth import login, logout
22
from django.conf import settings
3+
from django.core.exceptions import ObjectDoesNotExist
34

45
from rest_framework import status
56
from rest_framework.views import APIView
@@ -64,7 +65,7 @@ class LogoutView(APIView):
6465
def post(self, request):
6566
try:
6667
request.user.auth_token.delete()
67-
except:
68+
except (AttributeError, ObjectDoesNotExist):
6869
pass
6970

7071
logout(request)

0 commit comments

Comments
 (0)