diff options
author | MaĆgorzata Ksionek <mksionek@gitlab.com> | 2019-09-04 15:18:36 +0200 |
---|---|---|
committer | Yorick Peterse <yorick@yorickpeterse.com> | 2019-09-30 14:22:05 +0200 |
commit | 48bb855ece50ca7b53b821cfcf3d335a8106e286 (patch) | |
tree | ffe396e6d7284fcecf633cb08f8f10eddcbfbfbc /app/controllers/omniauth_callbacks_controller.rb | |
parent | c99402c05f18c6ca8dd7b64c59527abe1e6e80d4 (diff) | |
download | gitlab-ce-48bb855ece50ca7b53b821cfcf3d335a8106e286.tar.gz |
Add checking for email_verified key
Fix rubocop offences and add changelog
Add email_verified key for feature specs
Add code review remarks
Add code review remarks
Fix specs
Diffstat (limited to 'app/controllers/omniauth_callbacks_controller.rb')
-rw-r--r-- | app/controllers/omniauth_callbacks_controller.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index da92df89aed..ee2cf47d5cb 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -73,6 +73,14 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController end end + def salesforce + if oauth.dig('extra', 'email_verified') + handle_omniauth + else + fail_salesforce_login + end + end + private def omniauth_flow(auth_module, identity_linker: nil) @@ -173,7 +181,15 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController end def fail_auth0_login - flash[:alert] = _('Wrong extern UID provided. Make sure Auth0 is configured correctly.') + fail_login_with_message(_('Wrong extern UID provided. Make sure Auth0 is configured correctly.')) + end + + def fail_salesforce_login + fail_login_with_message(_('Email not verified. Please verify your email in Salesforce.')) + end + + def fail_login_with_message(message) + flash[:alert] = message redirect_to new_user_session_path end |