refactor(activation): more readable condition

This commit is contained in:
Colin Darie 2024-09-03 16:51:00 +02:00
parent 845a4582d3
commit d29cf3d222
No known key found for this signature in database
GPG key ID: 4FB865FDBCA4BCC4

View file

@ -36,7 +36,7 @@ class Users::ActivateController < ApplicationController
user = User.find_by(confirmation_token: params[:token]) user = User.find_by(confirmation_token: params[:token])
if user && user.email_verified_at if user && user.email_verified_at
flash[:notice] = "Votre email est déjà vérifié" flash[:notice] = "Votre email est déjà vérifié"
elsif user && 2.days.ago < user.confirmation_sent_at elsif user && user.confirmation_sent_at >= 2.days.ago
user.update!(email_verified_at: Time.zone.now) user.update!(email_verified_at: Time.zone.now)
flash[:notice] = 'Votre email a bien été vérifié' flash[:notice] = 'Votre email a bien été vérifié'
else else