feat: 忘记密码支持手机短信找回,并修改邮箱方式和手机方式统一 (#8960)

* feat: 忘记密码支持通过手机找回,邮箱方式修改为和手机方式一致

* feat: 翻译

* feat: 修改翻译

* fix: 还原

Co-authored-by: Jiangjie.Bai <bugatti_it@163.com>
This commit is contained in:
jiangweidong
2022-11-04 13:56:55 +08:00
committed by GitHub
parent 262d070f3c
commit 1e97a23bc5
15 changed files with 583 additions and 281 deletions

View File

@@ -2,7 +2,7 @@ from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from .base import BaseMFA
from common.sdk.sms import SendAndVerifySMSUtil
from common.utils.verify_code import SendAndVerifyCodeUtil
sms_failed_msg = _("SMS verify code invalid")
@@ -15,7 +15,7 @@ class MFASms(BaseMFA):
def __init__(self, user):
super().__init__(user)
phone = user.phone if self.is_authenticated() else ''
self.sms = SendAndVerifySMSUtil(phone)
self.sms = SendAndVerifyCodeUtil(phone, backend=self.name)
def check_code(self, code):
assert self.is_authenticated()
@@ -37,7 +37,7 @@ class MFASms(BaseMFA):
return True
def send_challenge(self):
self.sms.gen_and_send()
self.sms.gen_and_send_async()
@staticmethod
def global_enabled():