diff --git a/docs/api_endpoints.rst b/docs/api_endpoints.rst index 21cb62f..05e8691 100644 --- a/docs/api_endpoints.rst +++ b/docs/api_endpoints.rst @@ -16,7 +16,7 @@ Basic - email -- /rest-auth/password/reset/confim/ (POST) +- /rest-auth/password/reset/confirm/ (POST) - uid - token diff --git a/rest_auth/registration/views.py b/rest_auth/registration/views.py index ffdf59f..7fb2631 100644 --- a/rest_auth/registration/views.py +++ b/rest_auth/registration/views.py @@ -52,6 +52,10 @@ class Register(APIView, SignupView): class VerifyEmail(APIView, ConfirmEmailView): permission_classes = (AllowAny,) + allowed_methods = ('POST', 'OPTIONS', 'HEAD') + + def get(self, *args, **kwargs): + return Response({}, status=status.HTTP_405_METHOD_NOT_ALLOWED) def post(self, request, *args, **kwargs): self.kwargs['key'] = self.request.DATA.get('key', '') diff --git a/rest_auth/views.py b/rest_auth/views.py index a27c61d..0f18fd5 100644 --- a/rest_auth/views.py +++ b/rest_auth/views.py @@ -6,8 +6,6 @@ from rest_framework.views import APIView from rest_framework.response import Response from rest_framework.generics import GenericAPIView from rest_framework.permissions import IsAuthenticated, AllowAny -from rest_framework.authentication import SessionAuthentication, \ - TokenAuthentication from rest_framework.authtoken.models import Token from rest_framework.generics import RetrieveUpdateAPIView @@ -32,10 +30,6 @@ class Login(GenericAPIView): token_model = Token response_serializer = TokenSerializer - def get_serializer(self): - return self.serializer_class(data=self.request.DATA, - context={'request': self.request, 'view': self}) - def login(self): self.user = self.serializer.object['user'] self.token, created = self.token_model.objects.get_or_create( @@ -52,7 +46,7 @@ class Login(GenericAPIView): status=status.HTTP_400_BAD_REQUEST) def post(self, request, *args, **kwargs): - self.serializer = self.get_serializer() + self.serializer = self.get_serializer(data=self.request.DATA) if not self.serializer.is_valid(): return self.get_error_response() self.login() @@ -67,7 +61,7 @@ class Logout(APIView): Accepts/Returns nothing. """ - permissions_classes = (AllowAny,) + permission_classes = (AllowAny,) def post(self, request): try: