mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
sign_out_all_scopes is false by default
This commit is contained in:
parent
503d27f2e1
commit
4db3ac820b
3 changed files with 7 additions and 7 deletions
|
@ -158,7 +158,7 @@ module Devise
|
||||||
@@warden_config_block = nil
|
@@warden_config_block = nil
|
||||||
|
|
||||||
mattr_accessor :sign_out_all_scopes
|
mattr_accessor :sign_out_all_scopes
|
||||||
@@sign_out_all_scopes = true
|
@@sign_out_all_scopes = false
|
||||||
|
|
||||||
# Default way to setup Devise. Run rails generate devise_install to create
|
# Default way to setup Devise. Run rails generate devise_install to create
|
||||||
# a fresh initializer with all configuration values.
|
# a fresh initializer with all configuration values.
|
||||||
|
|
|
@ -175,9 +175,9 @@ module Devise
|
||||||
def sign_out_and_redirect(resource_or_scope)
|
def sign_out_and_redirect(resource_or_scope)
|
||||||
scope = Devise::Mapping.find_scope!(resource_or_scope)
|
scope = Devise::Mapping.find_scope!(resource_or_scope)
|
||||||
if Devise.sign_out_all_scopes
|
if Devise.sign_out_all_scopes
|
||||||
sign_out(scope)
|
|
||||||
else
|
|
||||||
sign_out_all_scopes
|
sign_out_all_scopes
|
||||||
|
else
|
||||||
|
sign_out(scope)
|
||||||
end
|
end
|
||||||
redirect_to after_sign_out_path_for(scope)
|
redirect_to after_sign_out_path_for(scope)
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,11 +3,11 @@ require 'test_helper'
|
||||||
class AuthenticationSanityTest < ActionController::IntegrationTest
|
class AuthenticationSanityTest < ActionController::IntegrationTest
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
Devise.sign_out_all_scopes = true
|
Devise.sign_out_all_scopes = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
Devise.sign_out_all_scopes = true
|
Devise.sign_out_all_scopes = false
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'home should be accessible without sign in' do
|
test 'home should be accessible without sign in' do
|
||||||
|
@ -57,7 +57,7 @@ class AuthenticationSanityTest < ActionController::IntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'sign out as user should also sign out admin if sign_out_all_scopes is true' do
|
test 'sign out as user should also sign out admin if sign_out_all_scopes is true' do
|
||||||
Devise.sign_out_all_scopes = false
|
Devise.sign_out_all_scopes = true
|
||||||
sign_in_as_user
|
sign_in_as_user
|
||||||
sign_in_as_admin
|
sign_in_as_admin
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class AuthenticationSanityTest < ActionController::IntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
test 'sign out as admin should also sign out user if sign_out_all_scopes is true' do
|
test 'sign out as admin should also sign out user if sign_out_all_scopes is true' do
|
||||||
Devise.sign_out_all_scopes = false
|
Devise.sign_out_all_scopes = true
|
||||||
sign_in_as_user
|
sign_in_as_user
|
||||||
sign_in_as_admin
|
sign_in_as_admin
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue