diff --git a/app/mailers/devise_notify_mailer.rb b/app/mailers/devise_notify_mailer.rb index 0a260dc3d..f04452f0f 100644 --- a/app/mailers/devise_notify_mailer.rb +++ b/app/mailers/devise_notify_mailer.rb @@ -13,29 +13,31 @@ class DeviseNotifyMailer < Devise::Mailer ) end - def personalisation(record, token) - url = public_send("edit_#{record.class.name.underscore}_password_url") + def personalisation(record, token, url) personalisation = { name: record.name || record.email, email: record.email, organisation: record.respond_to?(:organisation) ? record.organisation.name : "", - link: "#{url}?reset_password_token=#{token}", + link: "#{url}#{token}", } end def reset_password_instructions(record, token, _opts = {}) + base = public_send("edit_#{record.class.name.underscore}_password_url") + url = "#{base}?reset_password_token=" send_email( record.email, record.reset_password_notify_template, - personalisation(record, token) + personalisation(record, token, url) ) end def confirmation_instructions(record, token, _opts = {}) + url = "#{user_confirmation_url}?confirmation_token=" send_email( record.email, record.confirmable_template, - personalisation(record, token) + personalisation(record, token, url) ) end