mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-11-22 09:06:40 +03:00
Remove dependency on allauth for logout on GET
This commit is contained in:
parent
7fc875a4f5
commit
42ae22152a
|
@ -13,7 +13,7 @@ Basic
|
||||||
|
|
||||||
- /rest-auth/logout/ (POST, GET)
|
- /rest-auth/logout/ (POST, GET)
|
||||||
|
|
||||||
.. 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
|
.. 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
|
||||||
|
|
||||||
- token
|
- token
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,6 @@ from rest_framework.response import Response
|
||||||
from rest_framework.generics import GenericAPIView, RetrieveUpdateAPIView
|
from rest_framework.generics import GenericAPIView, RetrieveUpdateAPIView
|
||||||
from rest_framework.permissions import IsAuthenticated, AllowAny
|
from rest_framework.permissions import IsAuthenticated, AllowAny
|
||||||
|
|
||||||
if 'allauth' in settings.INSTALLED_APPS:
|
|
||||||
from allauth.account import app_settings as allauth_settings
|
|
||||||
|
|
||||||
from .app_settings import (
|
from .app_settings import (
|
||||||
TokenSerializer, UserDetailsSerializer, LoginSerializer,
|
TokenSerializer, UserDetailsSerializer, LoginSerializer,
|
||||||
PasswordResetSerializer, PasswordResetConfirmSerializer,
|
PasswordResetSerializer, PasswordResetConfirmSerializer,
|
||||||
|
@ -94,7 +91,7 @@ class LogoutView(APIView):
|
||||||
permission_classes = (AllowAny,)
|
permission_classes = (AllowAny,)
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
if 'allauth' in settings.INSTALLED_APPS and allauth_settings.LOGOUT_ON_GET:
|
if getattr(settings, 'ACCOUNT_LOGOUT_ON_GET', False):
|
||||||
response = self.logout(request)
|
response = self.logout(request)
|
||||||
else:
|
else:
|
||||||
response = self.http_method_not_allowed(request, *args, **kwargs)
|
response = self.http_method_not_allowed(request, *args, **kwargs)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user