resent email if link too old and better style email

This commit is contained in:
Lisa Durand 2024-07-15 11:30:30 +02:00
parent 3eabcb0736
commit e9f5389f83
No known key found for this signature in database
GPG key ID: 0DF91F2CA1E8B816
4 changed files with 29 additions and 15 deletions

View file

@ -38,8 +38,12 @@ class Users::ActivateController < ApplicationController
user.update!(email_verified_at: Time.zone.now)
flash[:notice] = 'Votre email a bien été vérifié'
else
flash[:alert] = "le lien est trop vieux"
# to do relancer un lien if user
if user.present?
flash[:alert] = "Ce lien n'est plus valable, un nouveau lien a été envoyé à l'adresse #{user.email}"
User.create_or_promote_to_tiers(user.email, SecureRandom.hex)
else
flash[:alert] = "Un problème est survenu, vous pouvez nous contacter sur #{Current.contact_email}"
end
end
redirect_to root_path(user)
end