mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-08 22:37:57 -05:00
Delegate sign_in_after_reset_password to resource class
Allows resource class scopes to overrides the global configuration for sign in after reset password behaviour.
This commit is contained in:
committed by
Carlos Antonio da Silva
parent
90f46bac37
commit
60c5774ff4
@@ -222,6 +222,31 @@ class PasswordTest < Devise::IntegrationTest
|
||||
end
|
||||
end
|
||||
|
||||
test 'does not sign in user automatically after changing its password if resource_class.sign_in_after_reset_password is false' do
|
||||
swap User, sign_in_after_reset_password: false do
|
||||
create_user
|
||||
request_forgot_password
|
||||
reset_password
|
||||
|
||||
assert_contain 'Your password has been changed successfully'
|
||||
assert_not_contain 'You are now signed in.'
|
||||
assert_equal new_user_session_path, @request.path
|
||||
assert !warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
|
||||
test 'sign in user automatically after changing its password if resource_class.sign_in_after_reset_password is true' do
|
||||
swap Devise, sign_in_after_reset_password: false do
|
||||
swap User, sign_in_after_reset_password: true do
|
||||
create_user
|
||||
request_forgot_password
|
||||
reset_password
|
||||
|
||||
assert warden.authenticated?(:user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
test 'does not sign in user automatically after changing its password if it\'s locked and unlock strategy is :none or :time' do
|
||||
[:none, :time].each do |strategy|
|
||||
swap Devise, unlock_strategy: strategy do
|
||||
|
||||
Reference in New Issue
Block a user