diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index 78a40b7c60..72f7ba85cd 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -320,6 +320,11 @@ class Enterprise < ActiveRecord::Base end end + # Based on a devise method, but without adding errors + def pending_any_confirmation? + !confirmed? || pending_reconfirmation? + end + protected def devise_mailer diff --git a/app/views/admin/enterprises/form/_contact.html.haml b/app/views/admin/enterprises/form/_contact.html.haml index c16f93f4b0..df28b6a921 100644 --- a/app/views/admin/enterprises/form/_contact.html.haml +++ b/app/views/admin/enterprises/form/_contact.html.haml @@ -1,9 +1,10 @@ --if @enterprise.unconfirmed_email +-if @enterprise.pending_any_confirmation? .alert-box - Email change is pending. + - email = @enterprise.confirmed? ? @enterprise.unconfirmed_email : @enterprise.email + Email confirmation is pending. We've sent a confirmation email to - %strong= "#{@enterprise.unconfirmed_email}." - = link_to('Resend', main_app.enterprise_confirmation_path(enterprise: { id: @enterprise.id, email: @enterprise.unconfirmed_email } ), method: :post) + %strong= "#{email}." + = link_to('Resend', main_app.enterprise_confirmation_path(enterprise: { id: @enterprise.id, email: email } ), method: :post) %a.close{ href: "#" } × .row .alpha.three.columns @@ -30,4 +31,4 @@ .alpha.three.columns = f.label :website .omega.eight.columns - = f.text_field :website, { placeholder: "eg. www.truffles.com"} \ No newline at end of file + = f.text_field :website, { placeholder: "eg. www.truffles.com"}