mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-23 05:28:53 +00:00
Merge pull request #2847 from Matt-Yorkley/emails/validation
Emails/validation
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -18,7 +18,12 @@ feature "Account Settings", js: true do
|
||||
expect(page).to have_content I18n.t('spree.users.form.account_settings')
|
||||
fill_in 'user_email', with: 'new@email.com'
|
||||
|
||||
click_button I18n.t(:update)
|
||||
expect do
|
||||
click_button I18n.t(:update)
|
||||
end.to send_confirmation_instructions
|
||||
|
||||
sent_mail = ActionMailer::Base.deliveries.last
|
||||
expect(sent_mail.to).to eq ['new@email.com']
|
||||
|
||||
expect(find(".alert-box.success").text.strip).to eq "#{I18n.t(:account_updated)} ×"
|
||||
user.reload
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user