Skip to content

user-accounts: Fix username validation

Xiang Fan requested to merge sfanxiang/gnome-control-center:username into master

man useradd says:

Usernames must start with a lower case letter or an underscore, followed by lower case letters, digits, underscores, or dashes. They can end with a dollar sign. In regular expression terms: [a-z_][a-z0-9_-]*[$]?

The current implementation uses different validation rules, so you can enter a username that will never be created. This patch makes it follow useradd except for starting _ or trailing $.

po files may need to be updated (I don't know how to do that).

Discovered and copied from gnome-initial-setup!30 (merged).

Merge request reports