fix(FranceConnect): missing after_confirmation callback, leading to invalites invitations when user france connect
This commit is contained in:
parent
e52bd9d6bf
commit
92730e266b
2 changed files with 10 additions and 0 deletions
|
@ -12,6 +12,7 @@ class FranceConnectInformation < ApplicationRecord
|
|||
password: Devise.friendly_token[0, 20],
|
||||
confirmed_at: Time.zone.now
|
||||
)
|
||||
user.after_confirmation
|
||||
rescue ActiveRecord::RecordNotUnique
|
||||
# ignore this exception because we check before is user is nil.
|
||||
# exception can be raised in race conditions, when FranceConnect calls callback 2 times.
|
||||
|
|
|
@ -96,6 +96,15 @@ describe FranceConnect::ParticulierController, type: :controller do
|
|||
expect(controller.current_user).to eq(user)
|
||||
expect(response).to redirect_to(root_path)
|
||||
end
|
||||
|
||||
context 'when invites are pending' do
|
||||
let!(:invite) { create(:invite, email: email, user: nil) }
|
||||
it 'links pending invites' do
|
||||
expect(invite.reload.user).to eq(nil)
|
||||
subject
|
||||
expect(invite.reload.user).to eq(User.last)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'and an user with the same email exists' do
|
||||
|
|
Loading…
Reference in a new issue