Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMałgorzata Ksionek <mksionek@gitlab.com>2019-09-04 16:18:36 +0300
committerMałgorzata Ksionek <mksionek@gitlab.com>2019-09-23 11:18:42 +0300
commit6ce2e6dfc65bb22c0d3a866bd7efe53044480787 (patch)
tree81fe7708833350d47e8f2a476726901078f0e0c2 /app/controllers
parent7099ecf77cb45c7b456a47f24064657ca59549b7 (diff)
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')
-rw-r--r--app/controllers/omniauth_callbacks_controller.rb18
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