Enforce username start with alpha letters or modify validate message.
Created by: cirosantilli
Probably usernames were first meant to start by alpha chars (not numeric 0-9), but at some point the restriction was dropped: currently https://github.com/gitlabhq/gitlabhq/blob/fb3104dabf5a6e47019a795bef70c6dbf1aea3b2/app/models/user.rb#L122 says:
format: { with: Gitlab::Regex.username_regex,
message: "only letters, digits & '_' '-' '.' allowed. Letter should be first" }
But Gitlab::Regex.username_regex
is currently resolving to https://github.com/gitlabhq/gitlabhq/blob/fb3104dabf5a6e47019a795bef70c6dbf1aea3b2/lib/gitlab/regex.rb#L52:
/\A[.?]?[a-zA-Z0-9_][a-zA-Z0-9_\-\.]*(?<!\.git)\z/
which does allow it to start with dot, numbers and underline.
Was the drop intentional or not? If yes, let's remove the message, else... we're in problem, as enforcing it now would be a data destructive migration.
It would be useful to enforce it because of: http://feedback.gitlab.com/forums/176466-general/suggestions/4168548-api-should-allow-getting-a-user-record-by-username , to avoid ambiguity between user ids and usernames.