diff options
author | Illya Klymov <xanf@xanf.me> | 2019-04-24 13:23:07 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-04-24 13:23:07 +0000 |
commit | 3eff85a97cee2a4143b80f97f750e02526aee1ab (patch) | |
tree | d51b069585762df9d497b10d078612828f6e6283 /app/controllers/sessions_controller.rb | |
parent | a89e8149b686c37962612779b0d245e7a90e59a8 (diff) | |
download | gitlab-ce-3eff85a97cee2a4143b80f97f750e02526aee1ab.tar.gz |
Remove "You are already signed in" banner
Diffstat (limited to 'app/controllers/sessions_controller.rb')
-rw-r--r-- | app/controllers/sessions_controller.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 6943795e8ac..6fea61cf45d 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -8,6 +8,8 @@ class SessionsController < Devise::SessionsController include Recaptcha::Verify skip_before_action :check_two_factor_requirement, only: [:destroy] + # replaced with :require_no_authentication_without_flash + skip_before_action :require_no_authentication, only: [:new, :create] prepend_before_action :check_initial_setup, only: [:new] prepend_before_action :authenticate_with_two_factor, @@ -15,6 +17,8 @@ class SessionsController < Devise::SessionsController prepend_before_action :check_captcha, only: [:create] prepend_before_action :store_redirect_uri, only: [:new] prepend_before_action :ldap_servers, only: [:new, :create] + prepend_before_action :require_no_authentication_without_flash, only: [:new, :create] + before_action :auto_sign_in_with_provider, only: [:new] before_action :load_recaptcha @@ -54,6 +58,14 @@ class SessionsController < Devise::SessionsController private + def require_no_authentication_without_flash + require_no_authentication + + if flash[:alert] == I18n.t('devise.failure.already_authenticated') + flash[:alert] = nil + end + end + def captcha_enabled? request.headers[CAPTCHA_HEADER] && Gitlab::Recaptcha.enabled? end |