Update email confirmation address

This commit is contained in:
Matt-Yorkley
2018-10-08 21:30:49 +01:00
parent 3ec8c12899
commit 8f5fd41c8b
2 changed files with 11 additions and 2 deletions

View File

@@ -13,8 +13,14 @@ Spree::UserMailer.class_eval do
@contact = ContentConfig.footer_email
subject = t('spree.user_mailer.confirmation_instructions.subject')
mail(to: user.email,
mail(to: confirmation_email_address,
from: from_address,
subject: subject)
end
private
def confirmation_email_address
@user.pending_reconfirmation? ? @user.unconfirmed_email : @user.email
end
end

View File

@@ -75,8 +75,11 @@ describe Spree.user_class do
create(:mail_method)
expect do
create(:user, confirmation_sent_at: nil, confirmed_at: nil)
create(:user, email: 'new_user@example.com', confirmation_sent_at: nil, confirmed_at: nil)
end.to send_confirmation_instructions
sent_mail = ActionMailer::Base.deliveries.last
expect(sent_mail.to).to eq ['new_user@example.com']
end
context "with the the same email as existing customers" do