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
  • #5592

Closed
Open
Created Nov 12, 2013 by Administrator@rootOwner

Unfriendly error message displayed when OAuth2 user creation fails on duplicate email

Created by: mxmader

I'm running 6.2-stable with google-oauth2 support enabled.

I've already got an account created with a specific email address (standard account created via GitLab UI).

When I attempt a login using my google account (same email address as standard account) I am subsequently presented with the following error message in my browser:

422
The change you wanted was rejected.

Maybe you tried to change something you didn't have access to.

With debug logging enabled, I see the following:

Completed 422 Unprocessable Entity in 221ms

ActiveRecord::RecordInvalid (Validation failed: Email has already been taken):
  lib/gitlab/oauth/user.rb:31:in `create'
  app/controllers/omniauth_callbacks_controller.rb:41:in `handle_omniauth'
  app/controllers/omniauth_callbacks_controller.rb:4:in `block (2 levels) in '
  app/controllers/application_controller.rb:54:in `set_current_user_for_thread'

It would be more helpful to transform the ActiveRecord validation error text "Validation failed: Email has already been taken" into an alert typical of the GitLab login menu style (currently a shaded red box in the footer of the window).

If I hadn't had debug logging enabled, I would not have quickly understood the root cause.

Assignee
Assign to
Time tracking