Fix email submission flow for suppliers

This commit is contained in:
2013-01-21 09:19:42 +01:00
parent 702bd41ee4
commit 4fd4fa3a85
3 changed files with 16 additions and 6 deletions
+11 -1
View File
@@ -97,11 +97,21 @@ class Supplier
# Overwrite devise method for mail sending
def self.confirm_by_token(confirmation_token)
confirmable = find_or_initialize_with_error_by(:confirmation_token, confirmation_token)
send_creation_mail = confirmable.errors.empty? && !confirmable.confirmed?
confirmable.confirm! if confirmable.persisted?
confirmable.send_creation_notifications if confirmable.errors.empty?
confirmable.send_creation_notifications if send_creation_mail
confirmable
end
# Send confirmation instructions by email
def send_confirmation_instructions
self.confirmation_token = nil if reconfirmation_required?
@reconfirmation_required = false
@bypass_postpone = true and generate_confirmation_token! if self.confirmation_token.blank?
self.devise_mailer.confirmation_instructions(self).deliver
end
def send_creation_notifications
SupplierMailer.creation(self).deliver
end
@@ -1,4 +1,4 @@
<h2>Resend confirmation instructions</h2>
<h2>Struur opnieuw bevestigingsinstructies</h2>
<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
<%= devise_error_messages! %>
@@ -6,7 +6,7 @@
<div><%= f.label :email %><br />
<%= f.email_field :email %></div>
<div><%= f.submit "Resend confirmation instructions" %></div>
<div><%= f.submit "Stuur opnieuw bevestigingsinstructies" %></div>
<% end %>
<%= render "links" %>
<%= render "links" %>
@@ -1,7 +1,7 @@
h3 "Welkom bij Qwaiter #{@resource.email}!"
p
|
Je hebt een account aangevraag bij Qwaiter. Als dit niet de bedoeling is kan je deze email negeren.
Om je account te activeren moet je op de bevestigingslink hieronder klikken:
Je hebt een account aangevraag bij Qwaiter of wil een wijziging doorvoeren waarvoor bevestiging nodig is. Als dit niet de bedoeling is kan je deze email negeren.
Om je account te activeren of de aangevraagde wijziging door te voeren moet je op de bevestigingslink hieronder klikken:
p= link_to 'Bevestig mijn Qwaiter account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)