Skip to content

Commit 42ae221

Browse files
committed
Remove dependency on allauth for logout on GET
1 parent 7fc875a commit 42ae221

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

docs/api_endpoints.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Basic
1313

1414
- /rest-auth/logout/ (POST, GET)
1515

16-
.. note:: (requires allauth) ``ACCOUNT_LOGOUT_ON_GET = True`` to allow logout using GET - this is the exact same conf from allauth. NOT recommended, see: http://django-allauth.readthedocs.io/en/latest/views.html#logout
16+
.. note:: ``ACCOUNT_LOGOUT_ON_GET = True`` to allow logout using GET - this is the exact same configuration from allauth. NOT recommended, see: http://django-allauth.readthedocs.io/en/latest/views.html#logout
1717

1818
- token
1919

rest_auth/views.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
from rest_framework.generics import GenericAPIView, RetrieveUpdateAPIView
1313
from rest_framework.permissions import IsAuthenticated, AllowAny
1414

15-
if 'allauth' in settings.INSTALLED_APPS:
16-
from allauth.account import app_settings as allauth_settings
17-
1815
from .app_settings import (
1916
TokenSerializer, UserDetailsSerializer, LoginSerializer,
2017
PasswordResetSerializer, PasswordResetConfirmSerializer,
@@ -94,7 +91,7 @@ class LogoutView(APIView):
9491
permission_classes = (AllowAny,)
9592

9693
def get(self, request, *args, **kwargs):
97-
if 'allauth' in settings.INSTALLED_APPS and allauth_settings.LOGOUT_ON_GET:
94+
if getattr(settings, 'ACCOUNT_LOGOUT_ON_GET', False):
9895
response = self.logout(request)
9996
else:
10097
response = self.http_method_not_allowed(request, *args, **kwargs)

0 commit comments

Comments
 (0)