fix build

This commit is contained in:
Max Peintner
2025-03-18 08:34:27 +01:00
parent 92c54e0f39
commit 2d0a0d567b
2 changed files with 13 additions and 11 deletions

View File

@@ -54,7 +54,8 @@ export default async function Page(props: {
token,
});
const { idpInformation, userId, addHumanUser } = intent;
const { idpInformation, userId } = intent;
let { addHumanUser } = intent;
// sign in user. If user should be linked continue
if (userId && !link) {
@@ -121,7 +122,7 @@ export default async function Page(props: {
// search for potential user via username, then link
if (options?.isLinkingAllowed) {
let foundUser;
const email = addHumanUser.email?.email;
const email = addHumanUser?.email?.email;
if (options.autoLinking === AutoLinkingOption.EMAIL && email) {
foundUser = await listUsers({ serviceUrl, email }).then((response) => {
@@ -177,10 +178,11 @@ export default async function Page(props: {
if (options?.isCreationAllowed && options.isAutoCreation) {
let orgToRegisterOn: string | undefined = organization;
let newUser;
if (
!orgToRegisterOn &&
addHumanUser.username && // username or email?
addHumanUser?.username && // username or email?
ORG_SUFFIX_REGEX.test(addHumanUser.username)
) {
const matched = ORG_SUFFIX_REGEX.exec(addHumanUser.username);
@@ -203,21 +205,21 @@ export default async function Page(props: {
}
}
if (orgToRegisterOn) {
if (addHumanUser && orgToRegisterOn) {
const organizationSchema = create(OrganizationSchema, {
org: { case: "orgId", value: orgToRegisterOn },
});
addHumanUser = create(AddHumanUserRequestSchema, {
const addHumanUserWithOrganization = create(AddHumanUserRequestSchema, {
...addHumanUser,
organization: organizationSchema,
});
}
const newUser = await addHuman({
newUser = await addHuman({
serviceUrl,
request: addHumanUser,
request: addHumanUserWithOrganization,
});
}
if (newUser) {
return (

View File

@@ -14,7 +14,7 @@
],
"sideEffects": false,
"scripts": {
"generate": "buf generate https://github.com/zitadel/zitadel.git#tag=v2.71.1 --path ./proto/zitadel",
"generate": "buf generate https://github.com/zitadel/zitadel.git --path ./proto/zitadel",
"clean": "rm -rf zitadel .turbo node_modules google protoc-gen-openapiv2 validate"
},
"dependencies": {