mirror of https://github.com/jumpserver/jumpserver
fix: 忘记密码短信验证码过期
parent
79f8480ae4
commit
1e0ea3905e
|
@ -7,7 +7,6 @@ from common.utils import validate_ssh_public_key
|
|||
from authentication.forms import EncryptedField, CaptchaMixin
|
||||
from ..models import User
|
||||
|
||||
|
||||
__all__ = [
|
||||
'UserProfileForm', 'UserMFAForm', 'UserFirstLoginFinishForm',
|
||||
'UserPasswordForm', 'UserPublicKeyForm', 'FileForm',
|
||||
|
@ -45,7 +44,6 @@ UserProfileForm.verbose_name = _("Profile")
|
|||
|
||||
|
||||
class UserMFAForm(forms.ModelForm):
|
||||
|
||||
mfa_description = _(
|
||||
'When enabled, '
|
||||
'you will enter the MFA binding process the next time you log in. '
|
||||
|
@ -100,6 +98,7 @@ class UserTokenResetPasswordForm(forms.Form):
|
|||
|
||||
class UserForgotPasswordForm(forms.Form):
|
||||
email = forms.CharField(label=_("Email"), required=False)
|
||||
country_code = forms.CharField(required=False)
|
||||
sms = forms.CharField(
|
||||
label=_('SMS'), required=False,
|
||||
help_text=_('The phone number must contain an area code, for example, +86')
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
<span class="country-code-value">+86</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu scrollable-menu">
|
||||
<input type="hidden" name="country_code" id="country_code" value="+86">
|
||||
{% for country in countries %}
|
||||
<li>
|
||||
<a href="#" class="dropdown-item d-flex justify-content-between">
|
||||
|
@ -121,6 +122,7 @@
|
|||
const inputGroupAddon = inputGroup.find('.country-code-value');
|
||||
const selectedCountry = $(evt.target).closest('li');
|
||||
const selectedCountryCode = selectedCountry.find('.country-code').html();
|
||||
$('#country_code').val(selectedCountryCode)
|
||||
inputGroupAddon.html(selectedCountryCode)
|
||||
});
|
||||
|
||||
|
|
|
@ -146,10 +146,12 @@ class UserForgotPasswordView(FormView):
|
|||
form_type = form.cleaned_data['form_type']
|
||||
target = form.cleaned_data[form_type]
|
||||
code = form.cleaned_data['code']
|
||||
country_code = form.cleaned_data.get('country_code', '')
|
||||
|
||||
query_key = form_type
|
||||
if form_type == 'sms':
|
||||
query_key = 'phone'
|
||||
target = '{}{}'.format(country_code, target)
|
||||
|
||||
try:
|
||||
self.safe_verify_code(token, target, form_type, code)
|
||||
|
|
Loading…
Reference in New Issue