From cdc232802796f1de14fbf76e0ecdddd65d749455 Mon Sep 17 00:00:00 2001 From: Bruce Liang Date: Mon, 22 Jan 2024 17:11:28 +0800 Subject: [PATCH] disable google recaptcha --- engine/apps/api/views/user.py | 11 +++++++---- .../phone_notifications/mocloud_phone_provider.py | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/engine/apps/api/views/user.py b/engine/apps/api/views/user.py index fe8e9cb6a3..07ab89ab15 100644 --- a/engine/apps/api/views/user.py +++ b/engine/apps/api/views/user.py @@ -417,11 +417,13 @@ def timezone_options(self, request) -> Response: ) def get_verification_code(self, request, pk) -> Response: logger.info("get_verification_code: validating reCAPTCHA code") - valid = check_recaptcha_internal_api(request, "mobile_verification_code") + # skip google recaptcha + # valid = check_recaptcha_internal_api(request, "mobile_verification_code") + valid = True if not valid: logger.warning("get_verification_code: invalid reCAPTCHA validation") return Response("failed reCAPTCHA check", status=status.HTTP_400_BAD_REQUEST) - logger.info('get_verification_code: pass reCAPTCHA validation"') + logger.info('get_verification_code: reCAPTCHA validation skiped"') user = self.get_object() phone_backend = PhoneBackend() @@ -443,8 +445,9 @@ def get_verification_code(self, request, pk) -> Response: throttle_classes=[GetPhoneVerificationCodeThrottlerPerUser, GetPhoneVerificationCodeThrottlerPerOrg], ) def get_verification_call(self, request, pk) -> Response: - logger.info("get_verification_code_via_call: validating reCAPTCHA code") - valid = check_recaptcha_internal_api(request, "mobile_verification_code") + # skip google recaptcha + # valid = check_recaptcha_internal_api(request, "mobile_verification_code") + valid = True if not valid: logger.warning("get_verification_code_via_call: invalid reCAPTCHA validation") return Response("failed reCAPTCHA check", status=status.HTTP_400_BAD_REQUEST) diff --git a/engine/apps/phone_notifications/mocloud_phone_provider.py b/engine/apps/phone_notifications/mocloud_phone_provider.py index 17af6b24e6..8006226de1 100644 --- a/engine/apps/phone_notifications/mocloud_phone_provider.py +++ b/engine/apps/phone_notifications/mocloud_phone_provider.py @@ -41,7 +41,7 @@ def finish_verification(self, number, code): Skip sms verification """ has = cache.get(self._cache_key(number)) - if has is not None and has == code: + if has is not None: return number else: return None