From a6e49b730b524af224577cd69d61fa944566f4e4 Mon Sep 17 00:00:00 2001 From: Bai Date: Mon, 14 Aug 2023 18:29:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BF=98=E8=AE=B0?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E4=B8=8D=E5=8C=85=E5=90=AB=E5=B7=A6=E4=BE=A7?= =?UTF-8?q?=20+=20=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/authentication/api/password.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/authentication/api/password.py b/apps/authentication/api/password.py index f1b245a46..86801bc6c 100644 --- a/apps/authentication/api/password.py +++ b/apps/authentication/api/password.py @@ -52,7 +52,11 @@ class UserResetPasswordSendCodeApi(CreateAPIView): other_args = {} target = serializer.validated_data[form_type] - query_key = 'phone' if form_type == 'sms' else form_type + if form_type == 'sms': + query_key = 'phone' + target = target.lstrip('+') + else: + query_key = form_type user, err = self.is_valid_user(username=username, **{query_key: target}) if not user: return Response({'error': err}, status=400)