diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-05-12 13:50:06 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-05-13 10:41:56 +0300 |
commit | 17a41547a038fd2ecb8b00499541861383927344 (patch) | |
tree | 426c9a33bc55ac5d77ab8c27ecde1f4e398c12fd /app/controllers/omniauth_callbacks_controller.rb | |
parent | 9eb45ccd552c7c0a3c2104f01e86120d7c9f4060 (diff) |
Improve OAuth signup error message.
Diffstat (limited to 'app/controllers/omniauth_callbacks_controller.rb')
-rw-r--r-- | app/controllers/omniauth_callbacks_controller.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index bb9d65c9ed6..dcd949a71de 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -65,8 +65,15 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController redirect_to omniauth_error_path(oauth['provider'], error: error_message) and return end end - rescue Gitlab::OAuth::ForbiddenAction => e - flash[:notice] = e.message + rescue Gitlab::OAuth::SignupDisabledError => e + message = "Signing in using your #{oauth['provider']} account without a pre-existing GitLab account is not allowed." + + if current_application_settings.signup_enabled? + message << " Create a GitLab account first, and then connect it to your #{oauth['provider']} account." + end + + flash[:notice] = message + redirect_to new_user_session_path end |