Issue 4895: Add `after_database_authentication` callback after sign_in immediately after password update (#4916)

This commit is contained in:
Kanmaniselvan Murugesan 2018-11-22 22:13:55 +01:00 committed by Leonardo Tegon
parent aa6cb411bc
commit bafc23eae5
2 changed files with 6 additions and 0 deletions

View File

@ -39,6 +39,7 @@ class Devise::PasswordsController < DeviseController
if Devise.sign_in_after_reset_password
flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
set_flash_message!(:notice, flash_message)
resource.after_database_authentication
sign_in(resource_name, resource)
else
set_flash_message!(:notice, :updated_not_active)

View File

@ -31,4 +31,9 @@ class PasswordsControllerTest < Devise::ControllerTestCase
put_update_with_params
assert_redirected_to custom_path
end
test 'calls after_database_authentication callback after sign_in immediately after password update' do
User.any_instance.expects :after_database_authentication
put_update_with_params
end
end