mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 10:37:32 +00:00
Merge branch 'main' into qa
This commit is contained in:
@@ -46,6 +46,8 @@ export default async function Page(props: { searchParams: Promise<any> }) {
|
|||||||
|
|
||||||
const doSend = invite !== "true";
|
const doSend = invite !== "true";
|
||||||
|
|
||||||
|
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? "";
|
||||||
|
|
||||||
if ("loginName" in searchParams) {
|
if ("loginName" in searchParams) {
|
||||||
sessionFactors = await loadMostRecentSession({
|
sessionFactors = await loadMostRecentSession({
|
||||||
serviceUrl,
|
serviceUrl,
|
||||||
@@ -59,10 +61,9 @@ export default async function Page(props: { searchParams: Promise<any> }) {
|
|||||||
if (doSend && sessionFactors?.factors?.user?.id) {
|
if (doSend && sessionFactors?.factors?.user?.id) {
|
||||||
await sendEmailCode({
|
await sendEmailCode({
|
||||||
serviceUrl,
|
serviceUrl,
|
||||||
|
|
||||||
userId: sessionFactors?.factors?.user?.id,
|
userId: sessionFactors?.factors?.user?.id,
|
||||||
urlTemplate:
|
urlTemplate:
|
||||||
`${host.includes("localhost") ? "http://" : "https://"}${host}/verify?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}&invite=true` +
|
`${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}/verify?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}&invite=true` +
|
||||||
(requestId ? `&requestId=${requestId}` : ""),
|
(requestId ? `&requestId=${requestId}` : ""),
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.error("Could not resend verification email", error);
|
console.error("Could not resend verification email", error);
|
||||||
@@ -73,10 +74,9 @@ export default async function Page(props: { searchParams: Promise<any> }) {
|
|||||||
if (doSend) {
|
if (doSend) {
|
||||||
await sendEmailCode({
|
await sendEmailCode({
|
||||||
serviceUrl,
|
serviceUrl,
|
||||||
|
|
||||||
userId,
|
userId,
|
||||||
urlTemplate:
|
urlTemplate:
|
||||||
`${host.includes("localhost") ? "http://" : "https://"}${host}/verify?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}&invite=true` +
|
`${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}/verify?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}&invite=true` +
|
||||||
(requestId ? `&requestId=${requestId}` : ""),
|
(requestId ? `&requestId=${requestId}` : ""),
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.error("Could not resend verification email", error);
|
console.error("Could not resend verification email", error);
|
||||||
|
@@ -76,6 +76,8 @@ export function LoginOTP({
|
|||||||
async function updateSessionForOTPChallenge() {
|
async function updateSessionForOTPChallenge() {
|
||||||
let challenges;
|
let challenges;
|
||||||
|
|
||||||
|
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? "";
|
||||||
|
|
||||||
if (method === "email") {
|
if (method === "email") {
|
||||||
challenges = create(RequestChallengesSchema, {
|
challenges = create(RequestChallengesSchema, {
|
||||||
otpEmail: {
|
otpEmail: {
|
||||||
@@ -84,7 +86,7 @@ export function LoginOTP({
|
|||||||
value: host
|
value: host
|
||||||
? {
|
? {
|
||||||
urlTemplate:
|
urlTemplate:
|
||||||
`${host.includes("localhost") ? "http://" : "https://"}${host}/otp/${method}?code={{.Code}}&userId={{.UserID}}&sessionId={{.SessionID}}` +
|
`${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}/otp/${method}?code={{.Code}}&userId={{.UserID}}&sessionId={{.SessionID}}` +
|
||||||
(requestId ? `&requestId=${requestId}` : ""),
|
(requestId ? `&requestId=${requestId}` : ""),
|
||||||
}
|
}
|
||||||
: {},
|
: {},
|
||||||
|
@@ -26,13 +26,14 @@ export async function startIDPFlow(command: StartIDPFlowCommand) {
|
|||||||
return { error: "Could not get host" };
|
return { error: "Could not get host" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? "";
|
||||||
|
|
||||||
return startIdentityProviderFlow({
|
return startIdentityProviderFlow({
|
||||||
serviceUrl,
|
serviceUrl,
|
||||||
|
|
||||||
idpId: command.idpId,
|
idpId: command.idpId,
|
||||||
urls: {
|
urls: {
|
||||||
successUrl: `${host.includes("localhost") ? "http://" : "https://"}${host}${command.successUrl}`,
|
successUrl: `${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}${command.successUrl}`,
|
||||||
failureUrl: `${host.includes("localhost") ? "http://" : "https://"}${host}${command.failureUrl}`,
|
failureUrl: `${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}${command.failureUrl}`,
|
||||||
},
|
},
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
if (
|
if (
|
||||||
|
@@ -43,10 +43,11 @@ export async function inviteUser(command: InviteUserCommand) {
|
|||||||
return { error: "Could not create user" };
|
return { error: "Could not create user" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? "";
|
||||||
|
|
||||||
const codeResponse = await createInviteCode({
|
const codeResponse = await createInviteCode({
|
||||||
serviceUrl,
|
serviceUrl,
|
||||||
|
urlTemplate: `${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}/verify?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}&invite=true`,
|
||||||
urlTemplate: `${host.includes("localhost") ? "http://" : "https://"}${host}/verify?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}&invite=true`,
|
|
||||||
userId: human.userId,
|
userId: human.userId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -104,16 +104,17 @@ export async function sendLoginname(command: SendLoginnameCommand) {
|
|||||||
params.set("organization", command.organization);
|
params.set("organization", command.organization);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? "";
|
||||||
|
|
||||||
const resp = await startIdentityProviderFlow({
|
const resp = await startIdentityProviderFlow({
|
||||||
serviceUrl,
|
serviceUrl,
|
||||||
|
|
||||||
idpId: identityProviders[0].id,
|
idpId: identityProviders[0].id,
|
||||||
urls: {
|
urls: {
|
||||||
successUrl:
|
successUrl:
|
||||||
`${host.includes("localhost") ? "http://" : "https://"}${host}/idp/${provider}/success?` +
|
`${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}/idp/${provider}/success?` +
|
||||||
new URLSearchParams(params),
|
new URLSearchParams(params),
|
||||||
failureUrl:
|
failureUrl:
|
||||||
`${host.includes("localhost") ? "http://" : "https://"}${host}/idp/${provider}/failure?` +
|
`${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}/idp/${provider}/failure?` +
|
||||||
new URLSearchParams(params),
|
new URLSearchParams(params),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -169,16 +170,17 @@ export async function sendLoginname(command: SendLoginnameCommand) {
|
|||||||
params.set("organization", command.organization);
|
params.set("organization", command.organization);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? "";
|
||||||
|
|
||||||
const resp = await startIdentityProviderFlow({
|
const resp = await startIdentityProviderFlow({
|
||||||
serviceUrl,
|
serviceUrl,
|
||||||
|
|
||||||
idpId: idp.id,
|
idpId: idp.id,
|
||||||
urls: {
|
urls: {
|
||||||
successUrl:
|
successUrl:
|
||||||
`${host.includes("localhost") ? "http://" : "https://"}${host}/idp/${provider}/success?` +
|
`${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}/idp/${provider}/success?` +
|
||||||
new URLSearchParams(params),
|
new URLSearchParams(params),
|
||||||
failureUrl:
|
failureUrl:
|
||||||
`${host.includes("localhost") ? "http://" : "https://"}${host}/idp/${provider}/failure?` +
|
`${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}/idp/${provider}/failure?` +
|
||||||
new URLSearchParams(params),
|
new URLSearchParams(params),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@@ -70,11 +70,13 @@ export async function resetPassword(command: ResetPasswordCommand) {
|
|||||||
}
|
}
|
||||||
const userId = users.result[0].userId;
|
const userId = users.result[0].userId;
|
||||||
|
|
||||||
|
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? "";
|
||||||
|
|
||||||
return passwordReset({
|
return passwordReset({
|
||||||
serviceUrl,
|
serviceUrl,
|
||||||
userId,
|
userId,
|
||||||
urlTemplate:
|
urlTemplate:
|
||||||
`${host.includes("localhost") ? "http://" : "https://"}${host}/password/set?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}` +
|
`${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}/password/set?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}` +
|
||||||
(command.requestId ? `&requestId=${command.requestId}` : ""),
|
(command.requestId ? `&requestId=${command.requestId}` : ""),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -257,14 +257,15 @@ export async function resendVerification(command: resendVerifyEmailCommand) {
|
|||||||
return { error: "No host found" };
|
return { error: "No host found" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? "";
|
||||||
|
|
||||||
return command.isInvite
|
return command.isInvite
|
||||||
? resendInviteCode({ serviceUrl, userId: command.userId })
|
? resendInviteCode({ serviceUrl, userId: command.userId })
|
||||||
: resendEmailCode({
|
: resendEmailCode({
|
||||||
userId: command.userId,
|
userId: command.userId,
|
||||||
serviceUrl,
|
serviceUrl,
|
||||||
|
|
||||||
urlTemplate:
|
urlTemplate:
|
||||||
`${host.includes("localhost") ? "http://" : "https://"}${host}/password/set?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}` +
|
`${host.includes("localhost") ? "http://" : "https://"}${host}${basePath}/password/set?code={{.Code}}&userId={{.UserID}}&organization={{.OrgID}}` +
|
||||||
(command.requestId ? `&requestId=${command.requestId}` : ""),
|
(command.requestId ? `&requestId=${command.requestId}` : ""),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user