From 2bc84a71eb39096f2d008be754efce6c1f787704 Mon Sep 17 00:00:00 2001 From: Andrej Date: Thu, 24 Jul 2025 12:22:08 +0200 Subject: [PATCH] Fix password reset for core [SCI-12091] --- app/controllers/users/passwords_controller.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/controllers/users/passwords_controller.rb b/app/controllers/users/passwords_controller.rb index 9b9644ab8..f10e61f31 100644 --- a/app/controllers/users/passwords_controller.rb +++ b/app/controllers/users/passwords_controller.rb @@ -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