From c3af718f1c485f451abcffd46eefaa0868a22043 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Fri, 22 Nov 2024 18:48:57 +0100 Subject: [PATCH] fix: user confirming their mail have its email verified --- app/models/user.rb | 1 + spec/system/users/sign_up_spec.rb | 2 ++ 2 files changed, 3 insertions(+) diff --git a/app/models/user.rb b/app/models/user.rb index e6a659e43..21e7ac312 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -61,6 +61,7 @@ class User < ApplicationRecord # Callback provided by Devise def after_confirmation + update!(email_verified_at: Time.zone.now) link_invites! end diff --git a/spec/system/users/sign_up_spec.rb b/spec/system/users/sign_up_spec.rb index 82a6154d3..9a0bc957b 100644 --- a/spec/system/users/sign_up_spec.rb +++ b/spec/system/users/sign_up_spec.rb @@ -10,9 +10,11 @@ describe 'Signing up:', js: true do sign_up_with user_email, user_password expect(page).to have_content "nous avons besoin de vérifier votre adresse électronique #{user_email}" + expect(User.find_by(email: user_email).email_verified_at).to be_nil click_confirmation_link_for user_email expect(page).to have_content('Votre compte a bien été confirmé.') + expect(User.find_by(email: user_email).email_verified_at).to be_present expect(page).to have_current_path dossiers_path end