Merge pull request #4829 from betagouv/fix-registration-link

Usager : correction du lien vers la démarche après l'inscription
This commit is contained in:
Pierre de La Morinerie 2020-02-25 15:23:36 +01:00 committed by GitHub
commit a025fa124e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View file

@ -15,7 +15,7 @@ class DeviseUserMailer < Devise::Mailer
def confirmation_instructions(record, token, opts = {})
opts[:from] = NO_REPLY_EMAIL
@procedure = CurrentConfirmation.procedure_after_confirmation || nil
@procedure = opts[:procedure_after_confirmation] || nil
super
end
end

View file

@ -25,6 +25,20 @@ class User < ApplicationRecord
before_validation -> { sanitize_email(:email) }
# Override of Devise::Models::Confirmable#send_confirmation_instructions
def send_confirmation_instructions
unless @raw_confirmation_token
generate_confirmation_token!
end
opts = pending_reconfirmation? ? { to: unconfirmed_email } : {}
# Make our procedure_after_confirmation available to the Mailer
opts[:procedure_after_confirmation] = CurrentConfirmation.procedure_after_confirmation
send_devise_notification(:confirmation_instructions, @raw_confirmation_token, opts)
end
# Callback provided by Devise
def after_confirmation
link_invites!