✅(backend) add test to secure updating user when matched on email
We had doubts that the user was correctly updated in the case where its identity was matched on the email and not on the sub. I added a test and confirmed that it was working correctly. I still modified the backend to update the user based on its "id" instead of its "sub" because it was confusing, but both actually work the same.
This commit is contained in:
committed by
Samuel Paccoud
parent
9f83ea7111
commit
945f55f50d
@@ -134,4 +134,4 @@ class OIDCAuthenticationBackend(MozillaOIDCAuthenticationBackend):
|
||||
)
|
||||
if has_changed:
|
||||
updated_claims = {key: value for key, value in claims.items() if value}
|
||||
self.UserModel.objects.filter(sub=user.sub).update(**updated_claims)
|
||||
self.UserModel.objects.filter(id=user.id).update(**updated_claims)
|
||||
|
||||
Reference in New Issue
Block a user