summaryrefslogtreecommitdiff
path: root/app/controllers/omniauth_callbacks_controller.rb
diff options
context:
space:
mode:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2018-04-22 19:08:08 +0100
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2018-04-22 23:50:56 +0100
commitf8d54913bb6f846d1204704d3a6e457956461b35 (patch)
tree7541e607f0e77638411448cf42482ee3ba778cf7 /app/controllers/omniauth_callbacks_controller.rb
parentf10c999bca2b5b37b068ff3680a6e35a6707828d (diff)
downloadgitlab-ce-f8d54913bb6f846d1204704d3a6e457956461b35.tar.gz
Show error on failed OAuth account link
Diffstat (limited to 'app/controllers/omniauth_callbacks_controller.rb')
-rw-r--r--app/controllers/omniauth_callbacks_controller.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb
index 190ad55859b..df75693e840 100644
--- a/app/controllers/omniauth_callbacks_controller.rb
+++ b/app/controllers/omniauth_callbacks_controller.rb
@@ -84,6 +84,8 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
if identity_linker.created?
redirect_identity_linked
+ elsif identity_linker.error_message.present?
+ redirect_identity_link_failed(identity_linker.error_message)
else
redirect_identity_exists
end
@@ -96,6 +98,10 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
redirect_to after_sign_in_path_for(current_user)
end
+ def redirect_identity_link_failed(error_message)
+ redirect_to profile_account_path, notice: "Authentication failed: #{error_message}"
+ end
+
def redirect_identity_linked
redirect_to profile_account_path, notice: 'Authentication method updated'
end