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:
Matt Redmond
2021-11-26 16:38:24 +10:30
committed by Carlos Antonio da Silva
parent 90f46bac37
commit 60c5774ff4
2 changed files with 27 additions and 2 deletions

View File

@@ -36,7 +36,7 @@ class Devise::PasswordsController < DeviseController
if resource.errors.empty?
resource.unlock_access! if unlockable?(resource)
if Devise.sign_in_after_reset_password
if resource_class.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
@@ -53,7 +53,7 @@ class Devise::PasswordsController < DeviseController
protected
def after_resetting_password_path_for(resource)
Devise.sign_in_after_reset_password ? after_sign_in_path_for(resource) : new_session_path(resource_name)
resource_class.sign_in_after_reset_password ? after_sign_in_path_for(resource) : new_session_path(resource_name)
end
# The path used after sending reset password instructions