Feat(user): verify user email during devise confirmation
This commit is contained in:
parent
bc8e3c35dd
commit
841c1cc845
2 changed files with 7 additions and 0 deletions
|
@ -63,6 +63,7 @@ class User < ApplicationRecord
|
||||||
|
|
||||||
# Callback provided by Devise
|
# Callback provided by Devise
|
||||||
def after_confirmation
|
def after_confirmation
|
||||||
|
update!(email_verified_at: Time.zone.now)
|
||||||
link_invites!
|
link_invites!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,12 @@ describe User, type: :model do
|
||||||
user.confirm
|
user.confirm
|
||||||
expect(user.reload.invites.size).to eq(2)
|
expect(user.reload.invites.size).to eq(2)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe '#owns?' do
|
describe '#owns?' do
|
||||||
|
|
Loading…
Reference in a new issue