Fix email submission flow for suppliers
This commit is contained in:
+11
-1
@@ -97,11 +97,21 @@ class Supplier
|
|||||||
# Overwrite devise method for mail sending
|
# Overwrite devise method for mail sending
|
||||||
def self.confirm_by_token(confirmation_token)
|
def self.confirm_by_token(confirmation_token)
|
||||||
confirmable = find_or_initialize_with_error_by(:confirmation_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.confirm! if confirmable.persisted?
|
||||||
confirmable.send_creation_notifications if confirmable.errors.empty?
|
confirmable.send_creation_notifications if send_creation_mail
|
||||||
confirmable
|
confirmable
|
||||||
end
|
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
|
def send_creation_notifications
|
||||||
SupplierMailer.creation(self).deliver
|
SupplierMailer.creation(self).deliver
|
||||||
end
|
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| %>
|
<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
|
||||||
<%= devise_error_messages! %>
|
<%= devise_error_messages! %>
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<div><%= f.label :email %><br />
|
<div><%= f.label :email %><br />
|
||||||
<%= f.email_field :email %></div>
|
<%= f.email_field :email %></div>
|
||||||
|
|
||||||
<div><%= f.submit "Resend confirmation instructions" %></div>
|
<div><%= f.submit "Stuur opnieuw bevestigingsinstructies" %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "links" %>
|
<%= render "links" %>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
h3 "Welkom bij Qwaiter #{@resource.email}!"
|
h3 "Welkom bij Qwaiter #{@resource.email}!"
|
||||||
p
|
p
|
||||||
|
|
|
|
||||||
Je hebt een account aangevraag bij Qwaiter. Als dit niet de bedoeling is kan je deze email negeren.
|
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 moet je op de bevestigingslink hieronder klikken:
|
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)
|
p= link_to 'Bevestig mijn Qwaiter account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token)
|
||||||
|
|||||||
Reference in New Issue
Block a user