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