diff --git a/apps/authentication/errors.py b/apps/authentication/errors.py index c8005ba95..f2346ab6d 100644 --- a/apps/authentication/errors.py +++ b/apps/authentication/errors.py @@ -71,7 +71,7 @@ sms_failed_msg = _( "(The account will be temporarily locked for {block_time} minutes)" ) mfa_type_failed_msg = _( - "The MFA type({mfa_type}) is not supported" + "The MFA type({mfa_type}) is not supported, " "You can also try {times_try} times " "(The account will be temporarily locked for {block_time} minutes)" ) diff --git a/apps/authentication/sms_verify_code.py b/apps/authentication/sms_verify_code.py index 33d17b207..0c3e986ce 100644 --- a/apps/authentication/sms_verify_code.py +++ b/apps/authentication/sms_verify_code.py @@ -52,10 +52,13 @@ class VerifyCodeUtil: ttl = self.ttl() if ttl > 0: raise CodeSendTooFrequently(ttl) - - self.generate() - self.save() - self.send() + try: + self.generate() + self.save() + self.send() + except JMSException: + self.clear() + raise def generate(self): code = ''.join(random.sample('0123456789', 4)) diff --git a/apps/authentication/templates/authentication/login_otp.html b/apps/authentication/templates/authentication/login_otp.html index 858c2737d..ff4d4e28b 100644 --- a/apps/authentication/templates/authentication/login_otp.html +++ b/apps/authentication/templates/authentication/login_otp.html @@ -19,19 +19,25 @@ {% endfor %} -