Merge "Fix js validation of the password in dynamic UI" into stable/newton

This commit is contained in:
Jenkins 2016-10-22 23:29:11 +00:00 committed by Gerrit Code Review
commit a8d6a97860
2 changed files with 8 additions and 4 deletions

View File

@ -214,6 +214,7 @@ class PasswordField(CharField):
% special_characters)
has_clone = False
original = True
attrs = {'data-type': 'password'}
validate_password = django_validator.RegexValidator(
password_re, _('The password must contain at least one letter, one \
number and one special character'), 'invalid')
@ -239,7 +240,8 @@ class PasswordField(CharField):
kwargs.update({'label': label,
'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')
help_text = kwargs.get('help_text')
@ -256,7 +258,8 @@ class PasswordField(CharField):
'invalid', self.validate_password.message)
kwargs['min_length'] = kwargs.get('min_length', 7)
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:
if not help_text:
# NOTE(kzaitsev) There are custom validators for password,

View File

@ -81,6 +81,7 @@ $(function() {
mainCheck(div, meetRequirements, true, text);
}
$("input[type='password']").not("[id$='-clone']").keyup(checkStrengthRemoveErrIfMatches);
$("input[id$='-clone'][type='password']").keyup(checkPasswordsMatch);
$(document).on("keyup", "input[data-type='password']:not([id$='clone'])",
checkStrengthRemoveErrIfMatches);
$(document).on("keyup", "input[id$='-clone'][data-type='password']", checkPasswordsMatch);
});