-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate user account value #5305
Conversation
34619ac
to
796db5c
Compare
796db5c
to
ba84fd6
Compare
setUserAccountInvalidHint(_("Sorry, that user name is not available. Please try another.")); | ||
} else if (isUserAccountWithInvalidCharacters(userAccount)) { | ||
valid = false; | ||
setUserAccountInvalidHint(_("The user name should usually only consist of lower case letters from a-z, digits and the following characters: -_")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actually allowed chars are .
-
and _
. I am not sure if we want to diverge from gnome desktop message and mention also .
but we could say and the following charcters: ._-
ba84fd6
to
9e14596
Compare
9e14596
to
964ee3a
Compare
userAccount === "root" || | ||
userAccount === "daemon" || | ||
userAccount === "home" || | ||
userAccount === "system" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could image this list in our config files, but it is probably not necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, or it will rather go to the backend with the validation.
Actually I was using wrong branch for the list so I had to extend it a bit and rebase the PR (sorry).
setUserAccountInvalidHint(_("Sorry, that user name is not available. Please try another.")); | ||
} else if (isUserAccountWithInvalidCharacters(userAccount)) { | ||
valid = false; | ||
setUserAccountInvalidHint(cockpit.format(_("The user name should usually only consist of lower case letters from a-z, digits and the following characters: $0"), "-_")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a hint for the future, it makes sense to add new validation methods to the DBus API, because ideally, we want all our user interfaces to use a similar logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I will create a Jira task for this improvement suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I was thinking about it as well, as a follow-up.
Hopefully with debouncing it won't have performance issues.
964ee3a
to
0205986
Compare
0205986
to
63fc98b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@garrett can you please review the helper messages.
Migrating to rhinstaller/anaconda-webui#47 |
The PR is addressing part of https://issues.redhat.com/browse/INSTALLER-3781
There are 3 types of hints/messages for invalid values in the PR - the behavior should be the same as in Gnome Users settings in rawhide (using the same messages including the interpunction). Valid values are the same as in the current Gtk UI (but the Gtk UI has different hints/messages, a bit more fine grained).
Please note that I replaced "username" with "user name" in the validation messages after creating the screenshots (the tests were failing on it).