Correct password-checking js in dynamic UI forms

Password-checking javascript selects password fields relying on a
fact that their ids should end with 'password' and 'password-
clone'. But it's not actually true when in application's 'ui.yaml'
file another name for password field is given.
This patch changes js in a way that it doesn't check presence of
'password' in the field id and uses just it's type. Also it
distinguish original password field and confirmation field by
'-clone' ending in id.

Change-Id: I9b9d7cdea8f5c5249cd7595b104424cf7a4055d4
Closes-bug: #1534642
This commit is contained in:
Valerii Kovalchuk 2016-05-26 15:32:12 +03:00
parent 3de32aa4ad
commit 6139b1bac1
2 changed files with 8 additions and 2 deletions

View File

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

View File

@ -0,0 +1,6 @@
---
fixes:
- Fixed password-checking in dynamic UI forms by using just type of the
field rather than type and ending of field id to determine the password
field. Previously password fields with the ids not ending with
'password' were not validated by javascript.