Skip to main content

is_valid_user_name

Function is_valid_user_name 

Source
pub fn is_valid_user_name(name: &str) -> bool
Expand description

Whether name may be given to a new or renamed account.

A user name becomes the final component of its account record path and of its default home (/users/<name>), so the accepted set is deliberately small: an ASCII letter followed by at most 31 ASCII letters, digits, _ or -. This rejects empty and overlong names, /, . and .., NUL and control characters, whitespace and non-ASCII text. The leading letter also keeps a name from colliding with the numeric /users/<identifier> homes of accounts created before homes were named after users.

Names are case-sensitive. Existing accounts are not revalidated when they are loaded, so older names keep working.