diff --git a/djoser/views.py b/djoser/views.py index c0de757c..09b9e46a 100644 --- a/djoser/views.py +++ b/djoser/views.py @@ -5,6 +5,7 @@ from rest_framework.decorators import action from rest_framework.exceptions import NotFound from rest_framework.response import Response +from rest_framework.serializers import Serializer from djoser import signals, utils from djoser.compat import get_user_email @@ -30,6 +31,7 @@ def _action(self, serializer): class TokenDestroyView(views.APIView): """Use this endpoint to logout user (remove user authentication token).""" + serializer_class = Serializer permission_classes = settings.PERMISSIONS.token_destroy def post(self, request): diff --git a/djoser/webauthn/urls.py b/djoser/webauthn/urls.py index 0f9c4095..86ff63af 100644 --- a/djoser/webauthn/urls.py +++ b/djoser/webauthn/urls.py @@ -5,7 +5,7 @@ urlpatterns = [ re_path( r"^signup_request/$", - views.SingupRequestView.as_view(), + views.SignupRequestView.as_view(), name="webauthn_signup_request", ), re_path( diff --git a/djoser/webauthn/views.py b/djoser/webauthn/views.py index 255105d7..c57a3399 100644 --- a/djoser/webauthn/views.py +++ b/djoser/webauthn/views.py @@ -29,11 +29,12 @@ User = get_user_model() -class SingupRequestView(APIView): +class SignupRequestView(APIView): permission_classes = (AllowAny,) + serializer_class = WebauthnSignupSerializer def post(self, request): - serializer = WebauthnSignupSerializer(data=request.data) + serializer = self.serializer_class(data=request.data) serializer.is_valid(raise_exception=True) co = serializer.save() @@ -95,9 +96,10 @@ def post(self, request, ukey): class LoginRequestView(APIView): permission_classes = (AllowAny,) + serializer_class = WebauthnLoginSerializer def post(self, request): - serializer = WebauthnLoginSerializer(data=request.data) + serializer = self.serializer_class(data=request.data) serializer.is_valid(raise_exception=True) co = CredentialOptions.objects.get( username=serializer.validated_data["username"]