From 6f3428dcecceaa0a51cb8db59b0dc1bc772a6cf1 Mon Sep 17 00:00:00 2001 From: behruz-dev Date: Wed, 29 Oct 2025 13:48:01 +0500 Subject: [PATCH] remove permission class on forgot password apis --- core/apps/accounts/views/forgot_password.py | 31 ++++++++------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/core/apps/accounts/views/forgot_password.py b/core/apps/accounts/views/forgot_password.py index d85b607..a13a0c4 100644 --- a/core/apps/accounts/views/forgot_password.py +++ b/core/apps/accounts/views/forgot_password.py @@ -4,49 +4,42 @@ from rest_framework.response import Response from core.apps.accounts.serializers import forgot_password as serializers from core.apps.accounts.tasks.user import create_and_send_sms_code + class SendCodeApiView(generics.GenericAPIView): serializer_class = serializers.SendCodeSerializer queryset = None + permission_classes = [] def post(self, request): serializer = self.serializer_class(data=request.data) if serializer.is_valid(raise_exception=True): data = serializer.data - create_and_send_sms_code.delay(data['phone'], 'forgot password') + create_and_send_sms_code.delay(data["phone"], "forgot password") return Response({"success": True, "message": "Kod yuborildi"}, status=201) - return Response({"success": False, "message": 'Kod yuborilmadi'}, status=400) - + return Response({"success": False, "message": "Kod yuborilmadi"}, status=400) + class ConfirmCodeApiView(generics.GenericAPIView): serializer_class = serializers.ConfirmPasswordSerializer queryset = None + permission_classes = [] def post(self, request): serializer = self.serializer_class(data=request.data) if serializer.is_valid(raise_exception=True): serializer.save() - return Response( - { - 'success': True, - "message": "tasdiqlandi" - } - ) - return Response({'success': True, "message": serializer.errors}) - + return Response({"success": True, "message": "tasdiqlandi"}) + return Response({"success": True, "message": serializer.errors}) + class ResetPasswordApiView(generics.GenericAPIView): serializer_class = serializers.ResetPasswordSerializer queryset = None + permission_classes = [] def post(self, request): serializer = self.serializer_class(data=request.data) if serializer.is_valid(raise_exception=True): serializer.save() - return Response( - { - 'success': True, - "message": "ozgartirildi" - } - ) - return Response({'success': True, "message": serializer.errors}) - \ No newline at end of file + return Response({"success": True, "message": "ozgartirildi"}) + return Response({"success": True, "message": serializer.errors})