diff options
author | James Lopez <james@gitlab.com> | 2017-08-07 18:35:11 +0000 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2017-08-07 18:35:11 +0000 |
commit | c7ece1f063e5d14bd092734f9c7832f3b730f87f (patch) | |
tree | cf4a6f64ea17442dd1917d53d44cc1a341e80d82 | |
parent | cf996b1a299bdd2dc23fdb4c8da8b8febc8d8cbb (diff) | |
download | gitlab-ce-feature/log-provider.tar.gz |
Update omniauth_callbacks_controller.rbfeature/log-provider
-rw-r--r-- | app/controllers/omniauth_callbacks_controller.rb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index 64c661794cc..b4213574561 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -38,8 +38,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController sign_in_and_redirect(@user) end else - flash[:alert] = "Access denied for your LDAP account." - redirect_to new_user_session_path + fail_ldap_login end end @@ -123,9 +122,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController sign_in_and_redirect(@user) end else - error_message = @user.errors.full_messages.to_sentence - - return redirect_to omniauth_error_path(oauth['provider'], error: error_message) + fail_login end end @@ -145,6 +142,18 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController def oauth @oauth ||= request.env['omniauth.auth'] end + + def fail_login + error_message = @user.errors.full_messages.to_sentence + + return redirect_to omniauth_error_path(oauth['provider'], error: error_message) + end + + def fail_ldap_login + flash[:alert] = 'Access denied for your LDAP account.' + + redirect_to new_user_session_path + end def log_audit_event(user, options = {}) AuditEventService.new(user, user, options) |