From 819fa2cde2ff61b798619dce9aa12d88492aebf4 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Fri, 31 May 2024 14:33:40 +0200 Subject: [PATCH] feat(User): always allow reset_password_instructions --- app/mailers/devise_user_mailer.rb | 6 ++++++ spec/mailers/devise_user_mailer_spec.rb | 1 + 2 files changed, 7 insertions(+) diff --git a/app/mailers/devise_user_mailer.rb b/app/mailers/devise_user_mailer.rb index 26cad7c03..5e993daa0 100644 --- a/app/mailers/devise_user_mailer.rb +++ b/app/mailers/devise_user_mailer.rb @@ -41,6 +41,12 @@ class DeviseUserMailer < Devise::Mailer end end + def reset_password_instructions(record, token, opts = {}) + bypass_unverified_mail_protection! + + super + end + def self.critical_email?(action_name) true end diff --git a/spec/mailers/devise_user_mailer_spec.rb b/spec/mailers/devise_user_mailer_spec.rb index 88fd2c21c..2044da2f2 100644 --- a/spec/mailers/devise_user_mailer_spec.rb +++ b/spec/mailers/devise_user_mailer_spec.rb @@ -73,6 +73,7 @@ RSpec.describe DeviseUserMailer, type: :mailer do it "respect preferred domain" do expect(header_value("From", subject.message)).to include(CONTACT_EMAIL) expect(subject.message.to_s).to include("#{ENV.fetch("APP_HOST_LEGACY")}/users/password") + expect(subject[BalancerDeliveryMethod::BYPASS_UNVERIFIED_MAIL_PROTECTION]).to be_present end end