diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2018-03-08 11:18:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-08 11:18:26 +0100 |
commit | a29d409e20e74c9a4f168c5c45fec9092e03ac61 (patch) | |
tree | 32d75b50aa797238592647729b65ed915bb05d8b | |
parent | 5acd5315f23b4472f31c4a0bb612b7356032defc (diff) |
If login redirects to omniauth, redirect logout to root_path (#6694)
Fix #6670
-rw-r--r-- | app/controllers/auth/sessions_controller.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/controllers/auth/sessions_controller.rb b/app/controllers/auth/sessions_controller.rb index 02447dde0..c1ebe760c 100644 --- a/app/controllers/auth/sessions_controller.rb +++ b/app/controllers/auth/sessions_controller.rb @@ -12,10 +12,9 @@ class Auth::SessionsController < Devise::SessionsController def new Devise.omniauth_configs.each do |provider, config| - if config.strategy.redirect_at_sign_in - return redirect_to(omniauth_authorize_path(resource_name, provider)) - end + return redirect_to(omniauth_authorize_path(resource_name, provider)) if config.strategy.redirect_at_sign_in end + super end @@ -59,6 +58,14 @@ class Auth::SessionsController < Devise::SessionsController end end + def after_sign_out_path_for(_resource_or_scope) + Devise.omniauth_configs.each_value do |config| + return root_path if config.strategy.redirect_at_sign_in + end + + super + end + def two_factor_enabled? find_user.try(:otp_required_for_login?) end |