Do not use stored location for sign out.
This commit is contained in:
parent
ce1bd142e2
commit
1e37e42239
|
@ -25,7 +25,7 @@ class Devise::SessionsController < ApplicationController
|
||||||
Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)
|
Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)
|
||||||
set_flash_message :notice, :signed_out if signed_in
|
set_flash_message :notice, :signed_out if signed_in
|
||||||
|
|
||||||
# We actually need to hardcode this, as Rails default responder doesn't
|
# We actually need to hardcode this as Rails default responder doesn't
|
||||||
# support returning empty response on GET request
|
# support returning empty response on GET request
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.any(*navigational_formats) { redirect_to redirect_path }
|
format.any(*navigational_formats) { redirect_to redirect_path }
|
||||||
|
|
|
@ -207,10 +207,9 @@ module Devise
|
||||||
# scope. Notice that differently from +after_sign_in_path_for+ this method
|
# scope. Notice that differently from +after_sign_in_path_for+ this method
|
||||||
# receives a symbol with the scope, and not the resource.
|
# receives a symbol with the scope, and not the resource.
|
||||||
#
|
#
|
||||||
# By default, it first tries to find a valid resource_return_to key in the
|
# By default it is the root_path.
|
||||||
# session, then it fallbacks to root_path.
|
|
||||||
def after_sign_out_path_for(resource_or_scope)
|
def after_sign_out_path_for(resource_or_scope)
|
||||||
stored_location_for(resource_or_scope) || root_path
|
root_path
|
||||||
end
|
end
|
||||||
|
|
||||||
# Sign in a user and tries to redirect first to the stored location and
|
# Sign in a user and tries to redirect first to the stored location and
|
||||||
|
|
|
@ -248,16 +248,6 @@ class ControllerAuthenticatableTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'sign out and redirect uses the stored location when signing out' do
|
|
||||||
swap Devise, :sign_out_all_scopes => true do
|
|
||||||
@mock_warden.expects(:user).times(Devise.mappings.size)
|
|
||||||
@mock_warden.expects(:logout).with().returns(true)
|
|
||||||
@controller.expects(:redirect_to).with("/foo.bar")
|
|
||||||
@controller.session[:"admin_return_to"] = "/foo.bar"
|
|
||||||
@controller.sign_out_and_redirect(:admin)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
test 'is not a devise controller' do
|
test 'is not a devise controller' do
|
||||||
assert_not @controller.devise_controller?
|
assert_not @controller.devise_controller?
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue