|
12 | 12 | from rest_framework.generics import GenericAPIView, RetrieveUpdateAPIView
|
13 | 13 | from rest_framework.permissions import IsAuthenticated, AllowAny
|
14 | 14 |
|
15 |
| -if 'allauth' in settings.INSTALLED_APPS: |
16 |
| - from allauth.account import app_settings as allauth_settings |
17 |
| - |
18 | 15 | from .app_settings import (
|
19 | 16 | TokenSerializer, UserDetailsSerializer, LoginSerializer,
|
20 | 17 | PasswordResetSerializer, PasswordResetConfirmSerializer,
|
@@ -94,13 +91,10 @@ class LogoutView(APIView):
|
94 | 91 | permission_classes = (AllowAny,)
|
95 | 92 |
|
96 | 93 | def get(self, request, *args, **kwargs):
|
97 |
| - try: |
98 |
| - if allauth_settings.LOGOUT_ON_GET: |
99 |
| - response = self.logout(request) |
100 |
| - else: |
101 |
| - response = self.http_method_not_allowed(request, *args, **kwargs) |
102 |
| - except Exception as exc: |
103 |
| - response = self.handle_exception(exc) |
| 94 | + if getattr(settings, 'ACCOUNT_LOGOUT_ON_GET', False): |
| 95 | + response = self.logout(request) |
| 96 | + else: |
| 97 | + response = self.http_method_not_allowed(request, *args, **kwargs) |
104 | 98 |
|
105 | 99 | return self.finalize_response(request, response, *args, **kwargs)
|
106 | 100 |
|
|
0 commit comments