user-form: only show "Passwords do not match" when there is confirmation password; make required when password #314
+11
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes part of https://issues.redhat.com/browse/AAH-362 ...
... and part of https://issues.redhat.com/browse/AAH-360
@sbuenafe-rh , @ZitaNemeckova I don't see any patternfly guidelines on how the password field + confirm password field combo should behave, so this is my best guess based on the assumption that the "Passwords do not match" message is not supposed to appear without any password there. (Which could be wrong given some of the effects below.)
So, this describes the create user/edit user form behaviour with this change in, in all the variants, I'm pretty sure the Save button is correct, not necessarily the rest :) .. I've added a question mark where I think something may be wrong, but if we make the field invalid when there is a password but no confirmation password, it implies that the message would appear when the user types in the password field.
Create new user:
Username, Password, Confirm are required
Save is disabled
no message, no invalid fields
Username, Password, Confirm are required
Save is disabled
yes message, confirm invalid
Username, Password, Confirm are required
Save is disabled
no message, no invalid fields ❓
Username, Password, Confirm are required
Save is disabled
yes message, confirm invalid
Username, Password, Confirm are required
Save is enabled
no message, confirm invalid
Edit user:
only Username required
Save is enabled
no message, no invalid fields
only Username required
Save is disabled
yes message, confirm invalid
Username and Confirm are required
Save is disabled
no message, no invalid fields ❓
maybe there should not be a placeholder confirm with nonempty password and appear empty ❓
Username and Confirm are required
Save is disabled
yes message, confirm invalid
Username and Confirm are required
Save is enabled
no message, confirm invalid
As for the mandatory confirmation field, I've made it mandatory only when the password is required (new user), or already entered (edit user, after changing the password), hope that makes sense :).
https://issues.redhat.com/browse/AAH-362 also contains...
As far as the api/model is concerned, only username/username+password is required.
So the question is: should we require First name, Last name, and Email as well? (If so, I'll add it, it's a trivial change.)