diff --git a/muranodashboard/dynamic_ui/fields.py b/muranodashboard/dynamic_ui/fields.py index b7de62770..1f561e5ed 100644 --- a/muranodashboard/dynamic_ui/fields.py +++ b/muranodashboard/dynamic_ui/fields.py @@ -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, diff --git a/muranodashboard/static/muranodashboard/js/passwordfield.js b/muranodashboard/static/muranodashboard/js/passwordfield.js index b3845fd21..2f7129ce6 100644 --- a/muranodashboard/static/muranodashboard/js/passwordfield.js +++ b/muranodashboard/static/muranodashboard/js/passwordfield.js @@ -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); });