Fix password reset for core [SCI-12091]

This commit is contained in:
Andrej 2025-07-24 12:22:08 +02:00 committed by Martin Artnik
parent 2b504ca159
commit 2bc84a71eb

View file

@ -5,9 +5,19 @@ class Users::PasswordsController < Devise::PasswordsController
# end
# POST /resource/password
# def create
# super
# end
def create
self.resource = resource_class.send_reset_password_instructions(resource_params)
yield resource if block_given?
if resource.errors.added?(:email, :blank)
flash.now[:alert] = I18n.t('devise.errors.email.empty')
self.resource = resource_class.new
render :new
else
set_flash_message!(:notice, :send_instructions)
respond_with({}, location: after_sending_reset_password_instructions_path_for(resource_name))
end
end
# GET /resource/password/edit?reset_password_token=abcdef
# def edit