Sign in with a user linked by france connect sub (openid)

instead of looking linked user by email because :

- follows FC recommendation to fetch ds account by openid
- the email is not a valid key as many user can share the same FCI email.

The following scenario is now working

A user A (email: 1@mail.com) uses FC to connect to DS
=> It is connected as 1@mail.com

Another user B (email: generic@mail.com) uses FC to connect
=> It is connected as generic@mail.com

The first user A change its FC email to generic@mail.com and connect to DS
=> It is still connected as 1@mail.com
This commit is contained in:
simon lehericey 2021-10-11 11:39:14 +02:00
parent 06dee2e023
commit 6826bf03b0
4 changed files with 40 additions and 45 deletions

View file

@ -18,15 +18,5 @@ describe FranceConnectInformation, type: :model do
expect(fci.user.email).to eq(fci.email_france_connect)
end
end
context 'when a user with same email (but who is not an instructeur) exist' do
let(:user) { create(:user) }
let(:fci) { build(:france_connect_information, email_france_connect: user.email) }
let(:subject) { fci.associate_user! }
before { subject }
it { expect(fci.user).to eq(user) }
end
end
end