Merge "Fix js validation of the password in dynamic UI" into stable/newton
This commit is contained in:
commit
a8d6a97860
|
@ -214,6 +214,7 @@ class PasswordField(CharField):
|
||||||
% special_characters)
|
% special_characters)
|
||||||
has_clone = False
|
has_clone = False
|
||||||
original = True
|
original = True
|
||||||
|
attrs = {'data-type': 'password'}
|
||||||
validate_password = django_validator.RegexValidator(
|
validate_password = django_validator.RegexValidator(
|
||||||
password_re, _('The password must contain at least one letter, one \
|
password_re, _('The password must contain at least one letter, one \
|
||||||
number and one special character'), 'invalid')
|
number and one special character'), 'invalid')
|
||||||
|
@ -239,7 +240,8 @@ class PasswordField(CharField):
|
||||||
|
|
||||||
kwargs.update({'label': label,
|
kwargs.update({'label': label,
|
||||||
'error_messages': kwargs.get('error_messages', {}),
|
'error_messages': kwargs.get('error_messages', {}),
|
||||||
'widget': forms.PasswordInput(render_value=True)})
|
'widget': forms.PasswordInput(attrs=self.attrs,
|
||||||
|
render_value=True)})
|
||||||
|
|
||||||
validators = kwargs.get('validators')
|
validators = kwargs.get('validators')
|
||||||
help_text = kwargs.get('help_text')
|
help_text = kwargs.get('help_text')
|
||||||
|
@ -256,7 +258,8 @@ class PasswordField(CharField):
|
||||||
'invalid', self.validate_password.message)
|
'invalid', self.validate_password.message)
|
||||||
kwargs['min_length'] = kwargs.get('min_length', 7)
|
kwargs['min_length'] = kwargs.get('min_length', 7)
|
||||||
kwargs['max_length'] = kwargs.get('max_length', 255)
|
kwargs['max_length'] = kwargs.get('max_length', 255)
|
||||||
kwargs['widget'] = self.PasswordInput(render_value=True)
|
kwargs['widget'] = self.PasswordInput(attrs=self.attrs,
|
||||||
|
render_value=True)
|
||||||
else:
|
else:
|
||||||
if not help_text:
|
if not help_text:
|
||||||
# NOTE(kzaitsev) There are custom validators for password,
|
# NOTE(kzaitsev) There are custom validators for password,
|
||||||
|
|
|
@ -81,6 +81,7 @@ $(function() {
|
||||||
mainCheck(div, meetRequirements, true, text);
|
mainCheck(div, meetRequirements, true, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
$("input[type='password']").not("[id$='-clone']").keyup(checkStrengthRemoveErrIfMatches);
|
$(document).on("keyup", "input[data-type='password']:not([id$='clone'])",
|
||||||
$("input[id$='-clone'][type='password']").keyup(checkPasswordsMatch);
|
checkStrengthRemoveErrIfMatches);
|
||||||
|
$(document).on("keyup", "input[id$='-clone'][data-type='password']", checkPasswordsMatch);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue