Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #7199

Closed
Open
Created Jun 25, 2014 by Administrator@rootOwner

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.

Assignee
Assign to
Time tracking