Merge pull request #10595 from demarches-simplifiees/email-mandant-need-confirmation-ldu

ETQ Mandant, je dois confirmer mon mail avant de recevoir des notifs
This commit is contained in:
Lisa Durand 2024-07-15 14:00:38 +00:00 committed by GitHub
commit 7630cc39fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 153 additions and 8 deletions

View file

@ -147,10 +147,14 @@ module Users
def update_identite
@dossier = dossier
@no_description = true
email = dossier_params.dig('individual_attributes', 'email')
if @dossier.update(dossier_params) && @dossier.individual.valid?
# TODO: remove this after proper mandat email validation
@dossier.individual.update!(email_verified_at: Time.zone.now)
# verify for_tiers email
if email.present?
User.create_or_promote_to_tiers(email, SecureRandom.hex, @dossier)
end
@dossier.update!(autorisation_donnees: true, identity_updated_at: Time.zone.now)
flash.notice = t('.identity_saved')