If login redirects to omniauth, redirect logout to root_path (#6694)
Fix #6670
This commit is contained in:
		
							parent
							
								
									5acd5315f2
								
							
						
					
					
						commit
						a29d409e20
					
				
					 1 changed files with 10 additions and 3 deletions
				
			
		| 
						 | 
					@ -12,10 +12,9 @@ class Auth::SessionsController < Devise::SessionsController
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def new
 | 
					  def new
 | 
				
			||||||
    Devise.omniauth_configs.each do |provider, config|
 | 
					    Devise.omniauth_configs.each do |provider, config|
 | 
				
			||||||
      if config.strategy.redirect_at_sign_in
 | 
					      return redirect_to(omniauth_authorize_path(resource_name, provider)) if config.strategy.redirect_at_sign_in
 | 
				
			||||||
        return redirect_to(omniauth_authorize_path(resource_name, provider))
 | 
					 | 
				
			||||||
      end
 | 
					 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    super
 | 
					    super
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,6 +58,14 @@ class Auth::SessionsController < Devise::SessionsController
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  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?
 | 
					  def two_factor_enabled?
 | 
				
			||||||
    find_user.try(:otp_required_for_login?)
 | 
					    find_user.try(:otp_required_for_login?)
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue