]> cat aescling's git repositories - mastodon.git/commitdiff
If login redirects to omniauth, redirect logout to root_path (#6694)
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 8 Mar 2018 10:18:26 +0000 (11:18 +0100)
committerGitHub <noreply@github.com>
Thu, 8 Mar 2018 10:18:26 +0000 (11:18 +0100)
Fix #6670

app/controllers/auth/sessions_controller.rb

index 02447dde069c99651245d48c971d175f43b3a8ae..c1ebe760c5d90814cb5ac2b64c938ed55ebeee21 100644 (file)
@@ -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