Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
PasswordField mysteriously masks other PasswordField
I implemented a new user tab containing two PasswordFields and wrote a validator to verify that the passwords were identical, and that worked fine.
Then I added a new tab with a bit of copy pasting where an admin can change a user's password, also containing two password fields and using a new instance of the same cross field validator to verify that the passwords are identical.
What happened when I introduced the new password change tab, was weird:
- The second password field from the first form disappeared
- The validator of the second form (the change password form) reported a mismatch even when the two passwords were identical
I have tried reverting the change, and that gave me the password field back in the new user tab (but of course no change password tab).
I have stared at the code to see if I could see some leftover unchanged variable names (ie. variable names that haven't had the "newUser" prefix changed to "editUser") but so far the new code looks correct to me.
All tips and hints are appreciated!
Some more details on the code:
- I'm using Java 1.8
- The code is running in a bundle webapp inside the apache karaf 4.0.7 OSGi container using the built-in pax-war feature (ie. jetty)
- The top of the project is here https://github.com/steinarb/ukelonn/tree/using-vaadin
- The pax-web war bundle (ie. the webapp) project is here: https://github.com/steinarb/ukelonn/tree/using-vaadin/ukelonn.bundle
- The UI containing the forms is here: https://github.com/steinarb/ukelonn/blob/using-vaadin/ukelonn.bundle/src/main/java/no/priv/bang/ukelonn/impl/UkelonnAdminUI.java
- The validator used to compare the content of two PasswordFields is here https://github.com/steinarb/ukelonn/blob/using-vaadin/ukelonn.bundle/src/main/java/no/priv/bang/ukelonn/impl/PasswordCompareValidator.java
- The commit that introduced the "new user" form, is: https://github.com/steinarb/ukelonn/commit/95d58c57c1666974ad72687be33f20c1409f396d
- The commit that introduced the "change user's password" form and caused the second password field in the "new user" form to disappear, is: https://github.com/steinarb/ukelonn/commit/bae89783ffeb4ae6e2863394d9243afdeb4d272d
At least in the commit "bae89783ffeb4ae6e2863394d9243afdeb4d272d" the line 424 has newUserPassword2Field instead of editUserPassword2Field
Thank you! :-)
(I knew it had to be a copy/paste error like this, I just couldn't see it... thanks again!)