mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-31 06:31:41 +00:00
Feedback when user changes email addess
This commit is contained in:
committed by
Rob Harrington
parent
ff18fd25f1
commit
fde0aba96c
@@ -9,6 +9,7 @@ Spree::UsersController.class_eval do
|
||||
# Ignores invoice orders, only order where state: 'complete'
|
||||
def show
|
||||
@orders = @user.orders.where(state: 'complete').order('completed_at desc')
|
||||
@unconfirmed_email = spree_current_user.unconfirmed_email
|
||||
|
||||
return unless Spree::Config.accounts_distributor_id
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/ insert_before "#password-credentials"
|
||||
|
||||
- if @unconfirmed_email
|
||||
%p.alert-box
|
||||
= t('spree.users.show.unconfirmed_email', unconfirmed_email: @unconfirmed_email)
|
||||
@@ -2361,6 +2361,7 @@ Please follow the instructions there to make your enterprise visible on the Open
|
||||
cards: Credit Cards
|
||||
transactions: Transactions
|
||||
settings: Account Settings
|
||||
unconfirmed_email: "Pending email confirmation for: %{unconfirmed_email}. Your email address will be updated once the new email is confirmed."
|
||||
orders:
|
||||
open_orders: Open Orders
|
||||
past_orders: Past Orders
|
||||
|
||||
@@ -4,7 +4,7 @@ feature "Account Settings", js: true do
|
||||
include AuthenticationWorkflow
|
||||
|
||||
describe "as a logged in user" do
|
||||
let(:user) { create(:user) }
|
||||
let(:user) { create(:user, email: 'old@email.com') }
|
||||
|
||||
before do
|
||||
quick_login_as user
|
||||
@@ -21,7 +21,10 @@ feature "Account Settings", js: true do
|
||||
|
||||
expect(find(".alert-box.success").text.strip).to eq "#{I18n.t(:account_updated)} ×"
|
||||
user.reload
|
||||
expect(user.email).to eq 'new@email.com'
|
||||
expect(user.email).to eq 'old@email.com'
|
||||
expect(user.unconfirmed_email).to eq 'new@email.com'
|
||||
click_link I18n.t('spree.users.show.tabs.settings')
|
||||
expect(page).to have_content I18n.t('spree.users.show.unconfirmed_email', unconfirmed_email: 'new@email.com')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user