Merge commit from fork

* fix: ensure external user's email is verified before auto-linking

* fix linking
This commit is contained in:
Livio Spring
2026-06-22 11:38:21 +02:00
committed by GitHub
parent 239620f112
commit 76fd6d859d
3 changed files with 15 additions and 11 deletions
@@ -101,6 +101,10 @@ describe("processIDPCallback", () => {
},
email: {
email: "[email protected]",
verification: {
case: "isVerified",
value: true
}
},
},
updateHumanUser: {
@@ -112,6 +116,10 @@ describe("processIDPCallback", () => {
},
email: {
email: "[email protected]",
verification: {
case: "isVerified",
value: true
}
},
},
};
+2 -10
View File
@@ -359,8 +359,9 @@ async function handleAutoLinking(ctx: IDPHandlerContext): Promise<IDPHandlerResu
if (options?.autoLinking) {
let foundUser;
const email = addHumanUser?.email?.email;
const emailVerified = addHumanUser?.email?.verification?.case === "isVerified" && addHumanUser?.email?.verification?.value;
if (options.autoLinking === AutoLinkingOption.EMAIL && email) {
if (options.autoLinking === AutoLinkingOption.EMAIL && email && emailVerified) {
foundUser = await listUsers({ serviceConfig, email, organizationId: organization }).then((response) => {
return response.result ? response.result[0] : null;
});
@@ -372,15 +373,6 @@ async function handleAutoLinking(ctx: IDPHandlerContext): Promise<IDPHandlerResu
}).then((response) => {
return response.result ? response.result[0] : null;
});
} else {
foundUser = await listUsers({
serviceConfig,
userName: idpInformation!.userName,
email,
organizationId: organization,
}).then((response) => {
return response.result ? response.result[0] : null;
});
}
if (foundUser) {