mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-12 14:54:33 +00:00
fix build
This commit is contained in:
@@ -27,7 +27,11 @@ export default async function Page(props: {
|
|||||||
const _headers = await headers();
|
const _headers = await headers();
|
||||||
const { serviceUrl, serviceRegion } = getServiceUrlFromHeaders(_headers);
|
const { serviceUrl, serviceRegion } = getServiceUrlFromHeaders(_headers);
|
||||||
|
|
||||||
const branding = await getBrandingSettings({ serviceUrl, organization });
|
const branding = await getBrandingSettings({
|
||||||
|
serviceUrl,
|
||||||
|
serviceRegion,
|
||||||
|
organization,
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DynamicTheme branding={branding}>
|
<DynamicTheme branding={branding}>
|
||||||
|
|||||||
@@ -125,11 +125,13 @@ export async function sendLoginname(command: SendLoginnameCommand) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const redirectUserToIDP = async (userId: string) => {
|
const redirectUserToIDP = async (userId: string) => {
|
||||||
const identityProviders = await listIDPLinks({ serviceUrl, userId }).then(
|
const identityProviders = await listIDPLinks({
|
||||||
(resp) => {
|
serviceUrl,
|
||||||
|
serviceRegion,
|
||||||
|
userId,
|
||||||
|
}).then((resp) => {
|
||||||
return resp.result;
|
return resp.result;
|
||||||
},
|
});
|
||||||
);
|
|
||||||
|
|
||||||
if (identityProviders.length === 1) {
|
if (identityProviders.length === 1) {
|
||||||
const _headers = await headers();
|
const _headers = await headers();
|
||||||
@@ -142,7 +144,11 @@ export async function sendLoginname(command: SendLoginnameCommand) {
|
|||||||
|
|
||||||
const identityProviderId = identityProviders[0].idpId;
|
const identityProviderId = identityProviders[0].idpId;
|
||||||
|
|
||||||
const idp = await getIDPByID({ serviceUrl, id: identityProviderId });
|
const idp = await getIDPByID({
|
||||||
|
serviceUrl,
|
||||||
|
serviceRegion,
|
||||||
|
id: identityProviderId,
|
||||||
|
});
|
||||||
|
|
||||||
const idpType = idp?.type;
|
const idpType = idp?.type;
|
||||||
|
|
||||||
@@ -407,7 +413,11 @@ export async function sendLoginname(command: SendLoginnameCommand) {
|
|||||||
const suffix = matched?.[1] ?? "";
|
const suffix = matched?.[1] ?? "";
|
||||||
|
|
||||||
// this just returns orgs where the suffix is set as primary domain
|
// this just returns orgs where the suffix is set as primary domain
|
||||||
const orgs = await getOrgsByDomain({ serviceUrl, domain: suffix });
|
const orgs = await getOrgsByDomain({
|
||||||
|
serviceUrl,
|
||||||
|
serviceRegion,
|
||||||
|
domain: suffix,
|
||||||
|
});
|
||||||
const orgToCheckForDiscovery =
|
const orgToCheckForDiscovery =
|
||||||
orgs.result && orgs.result.length === 1 ? orgs.result[0].id : undefined;
|
orgs.result && orgs.result.length === 1 ? orgs.result[0].id : undefined;
|
||||||
|
|
||||||
|
|||||||
@@ -160,7 +160,11 @@ export async function sendPasskey(command: SendPasskeyCommand) {
|
|||||||
const _headers = await headers();
|
const _headers = await headers();
|
||||||
const { serviceUrl, serviceRegion } = getServiceUrlFromHeaders(_headers);
|
const { serviceUrl, serviceRegion } = getServiceUrlFromHeaders(_headers);
|
||||||
|
|
||||||
const loginSettings = await getLoginSettings({ serviceUrl, organization });
|
const loginSettings = await getLoginSettings({
|
||||||
|
serviceUrl,
|
||||||
|
serviceRegion,
|
||||||
|
organization,
|
||||||
|
});
|
||||||
|
|
||||||
const lifetime = checks?.webAuthN
|
const lifetime = checks?.webAuthN
|
||||||
? loginSettings?.multiFactorCheckLifetime // TODO different lifetime for webauthn u2f/passkey
|
? loginSettings?.multiFactorCheckLifetime // TODO different lifetime for webauthn u2f/passkey
|
||||||
|
|||||||
@@ -265,7 +265,11 @@ export async function changePassword(command: {
|
|||||||
const { serviceUrl, serviceRegion } = getServiceUrlFromHeaders(_headers);
|
const { serviceUrl, serviceRegion } = getServiceUrlFromHeaders(_headers);
|
||||||
|
|
||||||
// check for init state
|
// check for init state
|
||||||
const { user } = await getUserByID({ serviceUrl, userId: command.userId });
|
const { user } = await getUserByID({
|
||||||
|
serviceUrl,
|
||||||
|
serviceRegion,
|
||||||
|
userId: command.userId,
|
||||||
|
});
|
||||||
|
|
||||||
if (!user || user.userId !== command.userId) {
|
if (!user || user.userId !== command.userId) {
|
||||||
return { error: "Could not send Password Reset Link" };
|
return { error: "Could not send Password Reset Link" };
|
||||||
@@ -348,29 +352,30 @@ export async function checkSessionAndSetPassword({
|
|||||||
|
|
||||||
// if the user has no MFA but MFA is enforced, we can set a password otherwise we use the token of the user
|
// if the user has no MFA but MFA is enforced, we can set a password otherwise we use the token of the user
|
||||||
if (forceMfa && hasNoMFAMethods) {
|
if (forceMfa && hasNoMFAMethods) {
|
||||||
return setPassword({ serviceUrl, payload }).catch((error) => {
|
return setPassword({ serviceUrl, serviceRegion, payload }).catch(
|
||||||
|
(error) => {
|
||||||
// throw error if failed precondition (ex. User is not yet initialized)
|
// throw error if failed precondition (ex. User is not yet initialized)
|
||||||
if (error.code === 9 && error.message) {
|
if (error.code === 9 && error.message) {
|
||||||
return { error: "Failed precondition" };
|
return { error: "Failed precondition" };
|
||||||
} else {
|
} else {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
const transport = async (host: string, token: string) => {
|
const transport = async (serviceUrl: string, token: string) => {
|
||||||
return createServerTransport(token, {
|
return createServerTransport(token, {
|
||||||
baseUrl: serviceUrl,
|
baseUrl: serviceUrl,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const myUserService = async (host: string, sessionToken: string) => {
|
const myUserService = async (serviceUrl: string, sessionToken: string) => {
|
||||||
const transportPromise = await transport(serviceUrl, sessionToken);
|
const transportPromise = await transport(serviceUrl, sessionToken);
|
||||||
return createUserServiceClient(transportPromise);
|
return createUserServiceClient(transportPromise);
|
||||||
};
|
};
|
||||||
|
|
||||||
const selfService = await myUserService(
|
const selfService = await myUserService(
|
||||||
serviceUrl,
|
serviceUrl,
|
||||||
serviceRegion,
|
|
||||||
`${sessionCookie.token}`,
|
`${sessionCookie.token}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,11 @@ export async function updateSession(options: UpdateSessionCommand) {
|
|||||||
challenges.webAuthN.domain = hostname;
|
challenges.webAuthN.domain = hostname;
|
||||||
}
|
}
|
||||||
|
|
||||||
const loginSettings = await getLoginSettings({ serviceUrl, organization });
|
const loginSettings = await getLoginSettings({
|
||||||
|
serviceUrl,
|
||||||
|
serviceRegion,
|
||||||
|
organization,
|
||||||
|
});
|
||||||
|
|
||||||
const lifetime = checks?.webAuthN
|
const lifetime = checks?.webAuthN
|
||||||
? loginSettings?.multiFactorCheckLifetime // TODO different lifetime for webauthn u2f/passkey
|
? loginSettings?.multiFactorCheckLifetime // TODO different lifetime for webauthn u2f/passkey
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export async function addU2F(command: RegisterU2FCommand) {
|
|||||||
return { error: "Could not get session" };
|
return { error: "Could not get session" };
|
||||||
}
|
}
|
||||||
|
|
||||||
return registerU2F({ serviceUrl, userId, domain: hostname });
|
return registerU2F({ serviceUrl, serviceRegion, userId, domain: hostname });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function verifyU2F(command: VerifyU2FCommand) {
|
export async function verifyU2F(command: VerifyU2FCommand) {
|
||||||
@@ -101,5 +101,5 @@ export async function verifyU2F(command: VerifyU2FCommand) {
|
|||||||
userId,
|
userId,
|
||||||
});
|
});
|
||||||
|
|
||||||
return verifyU2FRegistration({ serviceUrl, request });
|
return verifyU2FRegistration({ serviceUrl, serviceRegion, request });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user