elementary / initial-setup

New user setup app designed for elementary OS
https://elementary.io
GNU General Public License v3.0
36 stars 12 forks source link

Cannot have a username that begins with a number #141

Open zeebok opened 2 years ago

zeebok commented 2 years ago

What Happened?

When creating a user, it will autogenerate a username but allows you to change the username to whatever you would like. There is a validation for the username to be sure it is alphanumeric only but if a username starts with a digital it will fail validation.

For example User420 passes but 420User fails despite both falling under alphanumeric.

Steps to Reproduce

Go through initial setup until you are asked to create an account. Try to set the username field to start with a digit.

Expected Behavior

I should be able to create any username that is alphanumeric no matter the order of those characters.

OS Version

6.x (Odin)

Software Version

Latest release (I have run all updates)

Log Output

No response

Hardware Info

No response

vjr commented 2 years ago

Just a note that I may have recently read on an ubuntu mailing list that there may be a similar restriction of not allowing usernames to begin with a number, so anyone reviewing or working on this issue might want to double check that?

davidmhewitt commented 2 years ago

The systemd page on this topic is quite good: https://systemd.io/USER_NAMES/

In short, different distros have different rules for what constitutes a valid username.

The summary at the very bottom of that page gives a regex that aims to be compatible with all distros. That doesn't allow a digit as the first character.

So, for compatibility purposes, I'd be tempted to say that the current behaviour is already correct.

zeebok commented 2 years ago

Alright, at the very least then I would think the error message when failing validation should make that clear.