Feat(user): verify user email during devise confirmation

This commit is contained in:
simon lehericey 2024-05-27 09:59:48 +02:00
parent bc8e3c35dd
commit 841c1cc845
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
2 changed files with 7 additions and 0 deletions

View file

@ -63,6 +63,7 @@ class User < ApplicationRecord
# Callback provided by Devise
def after_confirmation
update!(email_verified_at: Time.zone.now)
link_invites!
end

View file

@ -16,6 +16,12 @@ describe User, type: :model do
user.confirm
expect(user.reload.invites.size).to eq(2)
end
it 'verifies its email' do
expect(user.email_verified_at).to be_nil
user.confirm
expect(user.email_verified_at).to be_present
end
end
describe '#owns?' do