mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-25 12:07:56 +00:00
host change everywhere
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
import { SessionsList } from "@/components/sessions-list";
|
import { SessionsList } from "@/components/sessions-list";
|
||||||
import { getAllSessionCookieIds } from "@/lib/cookies";
|
import { getAllSessionCookieIds } from "@/lib/cookies";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import {
|
import {
|
||||||
getBrandingSettings,
|
getBrandingSettings,
|
||||||
getDefaultOrg,
|
getDefaultOrg,
|
||||||
@@ -37,7 +38,9 @@ export default async function Page(props: {
|
|||||||
const authRequestId = searchParams?.authRequestId;
|
const authRequestId = searchParams?.authRequestId;
|
||||||
const organization = searchParams?.organization;
|
const organization = searchParams?.organization;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -5,6 +5,7 @@ import { DynamicTheme } from "@/components/dynamic-theme";
|
|||||||
import { SignInWithIdp } from "@/components/sign-in-with-idp";
|
import { SignInWithIdp } from "@/components/sign-in-with-idp";
|
||||||
import { UserAvatar } from "@/components/user-avatar";
|
import { UserAvatar } from "@/components/user-avatar";
|
||||||
import { getSessionCookieById } from "@/lib/cookies";
|
import { getSessionCookieById } from "@/lib/cookies";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import {
|
import {
|
||||||
getActiveIdentityProviders,
|
getActiveIdentityProviders,
|
||||||
@@ -28,7 +29,9 @@ export default async function Page(props: {
|
|||||||
|
|
||||||
const { loginName, authRequestId, organization, sessionId } = searchParams;
|
const { loginName, authRequestId, organization, sessionId } = searchParams;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { getBrandingSettings } from "@/lib/zitadel";
|
import { getBrandingSettings } from "@/lib/zitadel";
|
||||||
import { IdentityProviderType } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
|
import { IdentityProviderType } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
|
||||||
import { getLocale, getTranslations } from "next-intl/server";
|
import { getLocale, getTranslations } from "next-intl/server";
|
||||||
@@ -23,7 +24,9 @@ export default async function Page(props: {
|
|||||||
|
|
||||||
const { organization } = searchParams;
|
const { organization } = searchParams;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -5,6 +5,7 @@ import { linkingSuccess } from "@/components/idps/pages/linking-success";
|
|||||||
import { loginFailed } from "@/components/idps/pages/login-failed";
|
import { loginFailed } from "@/components/idps/pages/login-failed";
|
||||||
import { loginSuccess } from "@/components/idps/pages/login-success";
|
import { loginSuccess } from "@/components/idps/pages/login-success";
|
||||||
import { idpTypeToIdentityProviderType, PROVIDER_MAPPING } from "@/lib/idp";
|
import { idpTypeToIdentityProviderType, PROVIDER_MAPPING } from "@/lib/idp";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import {
|
import {
|
||||||
addHuman,
|
addHuman,
|
||||||
addIDPLink,
|
addIDPLink,
|
||||||
@@ -38,7 +39,9 @@ export default async function Page(props: {
|
|||||||
const { id, token, authRequestId, organization, link } = searchParams;
|
const { id, token, authRequestId, organization, link } = searchParams;
|
||||||
const { provider } = params;
|
const { provider } = params;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
import { SignInWithIdp } from "@/components/sign-in-with-idp";
|
import { SignInWithIdp } from "@/components/sign-in-with-idp";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { getActiveIdentityProviders, getBrandingSettings } from "@/lib/zitadel";
|
import { getActiveIdentityProviders, getBrandingSettings } from "@/lib/zitadel";
|
||||||
import { getLocale, getTranslations } from "next-intl/server";
|
import { getLocale, getTranslations } from "next-intl/server";
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
@@ -14,7 +15,9 @@ export default async function Page(props: {
|
|||||||
const authRequestId = searchParams?.authRequestId;
|
const authRequestId = searchParams?.authRequestId;
|
||||||
const organization = searchParams?.organization;
|
const organization = searchParams?.organization;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import { Alert, AlertType } from "@/components/alert";
|
import { Alert, AlertType } from "@/components/alert";
|
||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
import { InviteForm } from "@/components/invite-form";
|
import { InviteForm } from "@/components/invite-form";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import {
|
import {
|
||||||
getBrandingSettings,
|
getBrandingSettings,
|
||||||
getDefaultOrg,
|
getDefaultOrg,
|
||||||
@@ -19,7 +20,9 @@ export default async function Page(props: {
|
|||||||
|
|
||||||
let { firstname, lastname, email, organization } = searchParams;
|
let { firstname, lastname, email, organization } = searchParams;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -2,6 +2,7 @@ import { Alert, AlertType } from "@/components/alert";
|
|||||||
import { Button, ButtonVariants } from "@/components/button";
|
import { Button, ButtonVariants } from "@/components/button";
|
||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
import { UserAvatar } from "@/components/user-avatar";
|
import { UserAvatar } from "@/components/user-avatar";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { getBrandingSettings, getDefaultOrg, getUserByID } from "@/lib/zitadel";
|
import { getBrandingSettings, getDefaultOrg, getUserByID } from "@/lib/zitadel";
|
||||||
import { HumanUser, User } from "@zitadel/proto/zitadel/user/v2/user_pb";
|
import { HumanUser, User } from "@zitadel/proto/zitadel/user/v2/user_pb";
|
||||||
import { getLocale, getTranslations } from "next-intl/server";
|
import { getLocale, getTranslations } from "next-intl/server";
|
||||||
@@ -17,7 +18,9 @@ export default async function Page(props: {
|
|||||||
|
|
||||||
let { userId, organization } = searchParams;
|
let { userId, organization } = searchParams;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
import { SignInWithIdp } from "@/components/sign-in-with-idp";
|
import { SignInWithIdp } from "@/components/sign-in-with-idp";
|
||||||
import { UsernameForm } from "@/components/username-form";
|
import { UsernameForm } from "@/components/username-form";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import {
|
import {
|
||||||
getActiveIdentityProviders,
|
getActiveIdentityProviders,
|
||||||
getBrandingSettings,
|
getBrandingSettings,
|
||||||
@@ -24,7 +25,9 @@ export default async function Page(props: {
|
|||||||
const suffix = searchParams?.suffix;
|
const suffix = searchParams?.suffix;
|
||||||
const submit: boolean = searchParams?.submit === "true";
|
const submit: boolean = searchParams?.submit === "true";
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -4,6 +4,7 @@ import { ChooseSecondFactor } from "@/components/choose-second-factor";
|
|||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
import { UserAvatar } from "@/components/user-avatar";
|
import { UserAvatar } from "@/components/user-avatar";
|
||||||
import { getSessionCookieById } from "@/lib/cookies";
|
import { getSessionCookieById } from "@/lib/cookies";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import {
|
import {
|
||||||
getBrandingSettings,
|
getBrandingSettings,
|
||||||
@@ -23,7 +24,9 @@ export default async function Page(props: {
|
|||||||
|
|
||||||
const { loginName, authRequestId, organization, sessionId } = searchParams;
|
const { loginName, authRequestId, organization, sessionId } = searchParams;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -4,6 +4,7 @@ import { ChooseSecondFactorToSetup } from "@/components/choose-second-factor-to-
|
|||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
import { UserAvatar } from "@/components/user-avatar";
|
import { UserAvatar } from "@/components/user-avatar";
|
||||||
import { getSessionCookieById } from "@/lib/cookies";
|
import { getSessionCookieById } from "@/lib/cookies";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import {
|
import {
|
||||||
getBrandingSettings,
|
getBrandingSettings,
|
||||||
@@ -50,7 +51,9 @@ export default async function Page(props: {
|
|||||||
sessionId,
|
sessionId,
|
||||||
} = searchParams;
|
} = searchParams;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -3,6 +3,7 @@ import { DynamicTheme } from "@/components/dynamic-theme";
|
|||||||
import { LoginOTP } from "@/components/login-otp";
|
import { LoginOTP } from "@/components/login-otp";
|
||||||
import { UserAvatar } from "@/components/user-avatar";
|
import { UserAvatar } from "@/components/user-avatar";
|
||||||
import { getSessionCookieById } from "@/lib/cookies";
|
import { getSessionCookieById } from "@/lib/cookies";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import {
|
import {
|
||||||
getBrandingSettings,
|
getBrandingSettings,
|
||||||
@@ -22,7 +23,9 @@ export default async function Page(props: {
|
|||||||
const t = await getTranslations({ locale, namespace: "otp" });
|
const t = await getTranslations({ locale, namespace: "otp" });
|
||||||
const tError = await getTranslations({ locale, namespace: "error" });
|
const tError = await getTranslations({ locale, namespace: "error" });
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -4,6 +4,7 @@ import { Button, ButtonVariants } from "@/components/button";
|
|||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
import { TotpRegister } from "@/components/totp-register";
|
import { TotpRegister } from "@/components/totp-register";
|
||||||
import { UserAvatar } from "@/components/user-avatar";
|
import { UserAvatar } from "@/components/user-avatar";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import {
|
import {
|
||||||
addOTPEmail,
|
addOTPEmail,
|
||||||
@@ -32,7 +33,9 @@ export default async function Page(props: {
|
|||||||
searchParams;
|
searchParams;
|
||||||
const { method } = params;
|
const { method } = params;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -3,6 +3,7 @@ import { DynamicTheme } from "@/components/dynamic-theme";
|
|||||||
import { LoginPasskey } from "@/components/login-passkey";
|
import { LoginPasskey } from "@/components/login-passkey";
|
||||||
import { UserAvatar } from "@/components/user-avatar";
|
import { UserAvatar } from "@/components/user-avatar";
|
||||||
import { getSessionCookieById } from "@/lib/cookies";
|
import { getSessionCookieById } from "@/lib/cookies";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import {
|
import {
|
||||||
getBrandingSettings,
|
getBrandingSettings,
|
||||||
@@ -23,7 +24,9 @@ export default async function Page(props: {
|
|||||||
const { loginName, altPassword, authRequestId, organization, sessionId } =
|
const { loginName, altPassword, authRequestId, organization, sessionId } =
|
||||||
searchParams;
|
searchParams;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -2,6 +2,7 @@ import { Alert, AlertType } from "@/components/alert";
|
|||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
import { RegisterPasskey } from "@/components/register-passkey";
|
import { RegisterPasskey } from "@/components/register-passkey";
|
||||||
import { UserAvatar } from "@/components/user-avatar";
|
import { UserAvatar } from "@/components/user-avatar";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import { getBrandingSettings } from "@/lib/zitadel";
|
import { getBrandingSettings } from "@/lib/zitadel";
|
||||||
import { getLocale, getTranslations } from "next-intl/server";
|
import { getLocale, getTranslations } from "next-intl/server";
|
||||||
@@ -18,7 +19,9 @@ export default async function Page(props: {
|
|||||||
const { loginName, prompt, organization, authRequestId, userId } =
|
const { loginName, prompt, organization, authRequestId, userId } =
|
||||||
searchParams;
|
searchParams;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -2,6 +2,7 @@ import { Alert } from "@/components/alert";
|
|||||||
import { ChangePasswordForm } from "@/components/change-password-form";
|
import { ChangePasswordForm } from "@/components/change-password-form";
|
||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
import { UserAvatar } from "@/components/user-avatar";
|
import { UserAvatar } from "@/components/user-avatar";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import {
|
import {
|
||||||
getBrandingSettings,
|
getBrandingSettings,
|
||||||
@@ -14,7 +15,9 @@ import { headers } from "next/headers";
|
|||||||
export default async function Page(props: {
|
export default async function Page(props: {
|
||||||
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
searchParams: Promise<Record<string | number | symbol, string | undefined>>;
|
||||||
}) {
|
}) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -2,6 +2,7 @@ import { Alert } from "@/components/alert";
|
|||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
import { PasswordForm } from "@/components/password-form";
|
import { PasswordForm } from "@/components/password-form";
|
||||||
import { UserAvatar } from "@/components/user-avatar";
|
import { UserAvatar } from "@/components/user-avatar";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import {
|
import {
|
||||||
getBrandingSettings,
|
getBrandingSettings,
|
||||||
@@ -23,7 +24,9 @@ export default async function Page(props: {
|
|||||||
|
|
||||||
let { loginName, organization, authRequestId, alt } = searchParams;
|
let { loginName, organization, authRequestId, alt } = searchParams;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -2,6 +2,7 @@ import { Alert, AlertType } from "@/components/alert";
|
|||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
import { SetPasswordForm } from "@/components/set-password-form";
|
import { SetPasswordForm } from "@/components/set-password-form";
|
||||||
import { UserAvatar } from "@/components/user-avatar";
|
import { UserAvatar } from "@/components/user-avatar";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import {
|
import {
|
||||||
getBrandingSettings,
|
getBrandingSettings,
|
||||||
@@ -25,7 +26,9 @@ export default async function Page(props: {
|
|||||||
const { userId, loginName, organization, authRequestId, code, initial } =
|
const { userId, loginName, organization, authRequestId, code, initial } =
|
||||||
searchParams;
|
searchParams;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
import { RegisterForm } from "@/components/register-form";
|
import { RegisterForm } from "@/components/register-form";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import {
|
import {
|
||||||
getBrandingSettings,
|
getBrandingSettings,
|
||||||
getDefaultOrg,
|
getDefaultOrg,
|
||||||
@@ -21,7 +22,9 @@ export default async function Page(props: {
|
|||||||
let { firstname, lastname, email, organization, authRequestId } =
|
let { firstname, lastname, email, organization, authRequestId } =
|
||||||
searchParams;
|
searchParams;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
import { SetRegisterPasswordForm } from "@/components/set-register-password-form";
|
import { SetRegisterPasswordForm } from "@/components/set-register-password-form";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import {
|
import {
|
||||||
getBrandingSettings,
|
getBrandingSettings,
|
||||||
getDefaultOrg,
|
getDefaultOrg,
|
||||||
@@ -21,7 +22,9 @@ export default async function Page(props: {
|
|||||||
let { firstname, lastname, email, organization, authRequestId } =
|
let { firstname, lastname, email, organization, authRequestId } =
|
||||||
searchParams;
|
searchParams;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -3,6 +3,7 @@ import { DynamicTheme } from "@/components/dynamic-theme";
|
|||||||
import { SelfServiceMenu } from "@/components/self-service-menu";
|
import { SelfServiceMenu } from "@/components/self-service-menu";
|
||||||
import { UserAvatar } from "@/components/user-avatar";
|
import { UserAvatar } from "@/components/user-avatar";
|
||||||
import { getMostRecentCookieWithLoginname } from "@/lib/cookies";
|
import { getMostRecentCookieWithLoginname } from "@/lib/cookies";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import {
|
import {
|
||||||
createCallback,
|
createCallback,
|
||||||
getBrandingSettings,
|
getBrandingSettings,
|
||||||
@@ -59,7 +60,9 @@ export default async function Page(props: { searchParams: Promise<any> }) {
|
|||||||
const locale = getLocale();
|
const locale = getLocale();
|
||||||
const t = await getTranslations({ locale, namespace: "signedin" });
|
const t = await getTranslations({ locale, namespace: "signedin" });
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -3,6 +3,7 @@ import { DynamicTheme } from "@/components/dynamic-theme";
|
|||||||
import { LoginPasskey } from "@/components/login-passkey";
|
import { LoginPasskey } from "@/components/login-passkey";
|
||||||
import { UserAvatar } from "@/components/user-avatar";
|
import { UserAvatar } from "@/components/user-avatar";
|
||||||
import { getSessionCookieById } from "@/lib/cookies";
|
import { getSessionCookieById } from "@/lib/cookies";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import { getBrandingSettings, getSession } from "@/lib/zitadel";
|
import { getBrandingSettings, getSession } from "@/lib/zitadel";
|
||||||
import { getLocale, getTranslations } from "next-intl/server";
|
import { getLocale, getTranslations } from "next-intl/server";
|
||||||
@@ -18,7 +19,9 @@ export default async function Page(props: {
|
|||||||
|
|
||||||
const { loginName, authRequestId, sessionId, organization } = searchParams;
|
const { loginName, authRequestId, sessionId, organization } = searchParams;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -2,6 +2,7 @@ import { Alert } from "@/components/alert";
|
|||||||
import { DynamicTheme } from "@/components/dynamic-theme";
|
import { DynamicTheme } from "@/components/dynamic-theme";
|
||||||
import { RegisterU2f } from "@/components/register-u2f";
|
import { RegisterU2f } from "@/components/register-u2f";
|
||||||
import { UserAvatar } from "@/components/user-avatar";
|
import { UserAvatar } from "@/components/user-avatar";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import { getBrandingSettings } from "@/lib/zitadel";
|
import { getBrandingSettings } from "@/lib/zitadel";
|
||||||
import { getLocale, getTranslations } from "next-intl/server";
|
import { getLocale, getTranslations } from "next-intl/server";
|
||||||
@@ -17,7 +18,9 @@ export default async function Page(props: {
|
|||||||
|
|
||||||
const { loginName, organization, authRequestId, checkAfter } = searchParams;
|
const { loginName, organization, authRequestId, checkAfter } = searchParams;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -4,6 +4,7 @@ import { UserAvatar } from "@/components/user-avatar";
|
|||||||
import { VerifyForm } from "@/components/verify-form";
|
import { VerifyForm } from "@/components/verify-form";
|
||||||
import { VerifyRedirectButton } from "@/components/verify-redirect-button";
|
import { VerifyRedirectButton } from "@/components/verify-redirect-button";
|
||||||
import { sendEmailCode } from "@/lib/server/verify";
|
import { sendEmailCode } from "@/lib/server/verify";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import { loadMostRecentSession } from "@/lib/session";
|
import { loadMostRecentSession } from "@/lib/session";
|
||||||
import {
|
import {
|
||||||
getBrandingSettings,
|
getBrandingSettings,
|
||||||
@@ -24,7 +25,9 @@ export default async function Page(props: { searchParams: Promise<any> }) {
|
|||||||
const { userId, loginName, code, organization, authRequestId, invite } =
|
const { userId, loginName, code, organization, authRequestId, invite } =
|
||||||
searchParams;
|
searchParams;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import { getAllSessions } from "@/lib/cookies";
|
import { getAllSessions } from "@/lib/cookies";
|
||||||
import { idpTypeToSlug } from "@/lib/idp";
|
import { idpTypeToSlug } from "@/lib/idp";
|
||||||
import { sendLoginname, SendLoginnameCommand } from "@/lib/server/loginname";
|
import { sendLoginname, SendLoginnameCommand } from "@/lib/server/loginname";
|
||||||
|
import { getApiUrlOfHeaders } from "@/lib/service";
|
||||||
import {
|
import {
|
||||||
createCallback,
|
createCallback,
|
||||||
getActiveIdentityProviders,
|
getActiveIdentityProviders,
|
||||||
@@ -191,7 +192,9 @@ export async function GET(request: NextRequest) {
|
|||||||
const authRequestId = searchParams.get("authRequest");
|
const authRequestId = searchParams.get("authRequest");
|
||||||
const sessionId = searchParams.get("sessionId");
|
const sessionId = searchParams.get("sessionId");
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -15,6 +15,7 @@ import {
|
|||||||
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
|
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
|
||||||
import { Checks } from "@zitadel/proto/zitadel/session/v2/session_service_pb";
|
import { Checks } from "@zitadel/proto/zitadel/session/v2/session_service_pb";
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
|
import { getApiUrlOfHeaders } from "../service";
|
||||||
|
|
||||||
type CustomCookieData = {
|
type CustomCookieData = {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -33,7 +34,9 @@ export async function createSessionAndUpdateCookie(
|
|||||||
authRequestId: string | undefined,
|
authRequestId: string | undefined,
|
||||||
lifetime?: Duration,
|
lifetime?: Duration,
|
||||||
): Promise<Session> {
|
): Promise<Session> {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
throw new Error("Could not get domain");
|
throw new Error("Could not get domain");
|
||||||
@@ -98,7 +101,9 @@ export async function createSessionForIdpAndUpdateCookie(
|
|||||||
authRequestId: string | undefined,
|
authRequestId: string | undefined,
|
||||||
lifetime?: Duration,
|
lifetime?: Duration,
|
||||||
): Promise<Session> {
|
): Promise<Session> {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
throw new Error("Could not get domain");
|
throw new Error("Could not get domain");
|
||||||
@@ -163,7 +168,9 @@ export async function setSessionAndUpdateCookie(
|
|||||||
authRequestId?: string,
|
authRequestId?: string,
|
||||||
lifetime?: Duration,
|
lifetime?: Duration,
|
||||||
) {
|
) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
throw new Error("Could not get domain");
|
throw new Error("Could not get domain");
|
||||||
|
@@ -7,6 +7,7 @@ import {
|
|||||||
} from "@/lib/zitadel";
|
} from "@/lib/zitadel";
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
import { getNextUrl } from "../client";
|
import { getNextUrl } from "../client";
|
||||||
|
import { getApiUrlOfHeaders } from "../service";
|
||||||
import { checkEmailVerification } from "../verify-helper";
|
import { checkEmailVerification } from "../verify-helper";
|
||||||
import { createSessionForIdpAndUpdateCookie } from "./cookie";
|
import { createSessionForIdpAndUpdateCookie } from "./cookie";
|
||||||
|
|
||||||
@@ -17,7 +18,9 @@ export type StartIDPFlowCommand = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function startIDPFlow(command: StartIDPFlowCommand) {
|
export async function startIDPFlow(command: StartIDPFlowCommand) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
return { error: "Could not get host" };
|
return { error: "Could not get host" };
|
||||||
@@ -56,7 +59,9 @@ type CreateNewSessionCommand = {
|
|||||||
export async function createNewSessionFromIdpIntent(
|
export async function createNewSessionFromIdpIntent(
|
||||||
command: CreateNewSessionCommand,
|
command: CreateNewSessionCommand,
|
||||||
) {
|
) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
return { error: "Could not get domain" };
|
return { error: "Could not get domain" };
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
import { addHumanUser, createInviteCode } from "@/lib/zitadel";
|
import { addHumanUser, createInviteCode } from "@/lib/zitadel";
|
||||||
import { Factors } from "@zitadel/proto/zitadel/session/v2/session_pb";
|
import { Factors } from "@zitadel/proto/zitadel/session/v2/session_pb";
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
|
import { getApiUrlOfHeaders } from "../service";
|
||||||
|
|
||||||
type InviteUserCommand = {
|
type InviteUserCommand = {
|
||||||
email: string;
|
email: string;
|
||||||
@@ -20,7 +21,9 @@ export type RegisterUserResponse = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function inviteUser(command: InviteUserCommand) {
|
export async function inviteUser(command: InviteUserCommand) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
return { error: "Could not get domain" };
|
return { error: "Could not get domain" };
|
||||||
|
@@ -8,6 +8,7 @@ import { idpTypeToIdentityProviderType, idpTypeToSlug } from "../idp";
|
|||||||
|
|
||||||
import { PasskeysType } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
|
import { PasskeysType } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
|
||||||
import { UserState } from "@zitadel/proto/zitadel/user/v2/user_pb";
|
import { UserState } from "@zitadel/proto/zitadel/user/v2/user_pb";
|
||||||
|
import { getApiUrlOfHeaders } from "../service";
|
||||||
import { checkInvite } from "../verify-helper";
|
import { checkInvite } from "../verify-helper";
|
||||||
import {
|
import {
|
||||||
getActiveIdentityProviders,
|
getActiveIdentityProviders,
|
||||||
@@ -32,7 +33,9 @@ export type SendLoginnameCommand = {
|
|||||||
const ORG_SUFFIX_REGEX = /(?<=@)(.+)/;
|
const ORG_SUFFIX_REGEX = /(?<=@)(.+)/;
|
||||||
|
|
||||||
export async function sendLoginname(command: SendLoginnameCommand) {
|
export async function sendLoginname(command: SendLoginnameCommand) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
throw new Error("Could not get domain");
|
throw new Error("Could not get domain");
|
||||||
@@ -76,7 +79,9 @@ export async function sendLoginname(command: SendLoginnameCommand) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (identityProviders.length === 1) {
|
if (identityProviders.length === 1) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
return { error: "Could not get host" };
|
return { error: "Could not get host" };
|
||||||
@@ -123,7 +128,9 @@ export async function sendLoginname(command: SendLoginnameCommand) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (identityProviders.length === 1) {
|
if (identityProviders.length === 1) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
return { error: "Could not get host" };
|
return { error: "Could not get host" };
|
||||||
|
@@ -13,6 +13,7 @@ import {
|
|||||||
getSessionCookieById,
|
getSessionCookieById,
|
||||||
getSessionCookieByLoginName,
|
getSessionCookieByLoginName,
|
||||||
} from "../cookies";
|
} from "../cookies";
|
||||||
|
import { getApiUrlOfHeaders } from "../service";
|
||||||
import { getLoginSettings } from "../zitadel";
|
import { getLoginSettings } from "../zitadel";
|
||||||
|
|
||||||
export type SetOTPCommand = {
|
export type SetOTPCommand = {
|
||||||
@@ -25,7 +26,9 @@ export type SetOTPCommand = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function setOTP(command: SetOTPCommand) {
|
export async function setOTP(command: SetOTPCommand) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
throw new Error("Could not get domain");
|
throw new Error("Could not get domain");
|
||||||
|
@@ -22,6 +22,7 @@ import {
|
|||||||
getSessionCookieById,
|
getSessionCookieById,
|
||||||
getSessionCookieByLoginName,
|
getSessionCookieByLoginName,
|
||||||
} from "../cookies";
|
} from "../cookies";
|
||||||
|
import { getApiUrlOfHeaders } from "../service";
|
||||||
import { checkEmailVerification } from "../verify-helper";
|
import { checkEmailVerification } from "../verify-helper";
|
||||||
import { setSessionAndUpdateCookie } from "./cookie";
|
import { setSessionAndUpdateCookie } from "./cookie";
|
||||||
|
|
||||||
@@ -41,7 +42,9 @@ export async function registerPasskeyLink(
|
|||||||
): Promise<RegisterPasskeyResponse> {
|
): Promise<RegisterPasskeyResponse> {
|
||||||
const { sessionId } = command;
|
const { sessionId } = command;
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
throw new Error("Could not get domain");
|
throw new Error("Could not get domain");
|
||||||
@@ -86,7 +89,9 @@ export async function registerPasskeyLink(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function verifyPasskeyRegistration(command: VerifyPasskeyCommand) {
|
export async function verifyPasskeyRegistration(command: VerifyPasskeyCommand) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
throw new Error("Could not get domain");
|
throw new Error("Could not get domain");
|
||||||
@@ -152,7 +157,9 @@ export async function sendPasskey(command: SendPasskeyCommand) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
return { error: "Could not get host" };
|
return { error: "Could not get host" };
|
||||||
|
@@ -44,7 +44,9 @@ type ResetPasswordCommand = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function resetPassword(command: ResetPasswordCommand) {
|
export async function resetPassword(command: ResetPasswordCommand) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
@@ -76,7 +78,9 @@ export type UpdateSessionCommand = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function sendPassword(command: UpdateSessionCommand) {
|
export async function sendPassword(command: UpdateSessionCommand) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
@@ -249,7 +253,9 @@ export async function changePassword(command: {
|
|||||||
userId: string;
|
userId: string;
|
||||||
password: string;
|
password: string;
|
||||||
}) {
|
}) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -10,6 +10,7 @@ import {
|
|||||||
} from "@zitadel/proto/zitadel/session/v2/session_service_pb";
|
} from "@zitadel/proto/zitadel/session/v2/session_service_pb";
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
import { getNextUrl } from "../client";
|
import { getNextUrl } from "../client";
|
||||||
|
import { getApiUrlOfHeaders } from "../service";
|
||||||
import { checkEmailVerification } from "../verify-helper";
|
import { checkEmailVerification } from "../verify-helper";
|
||||||
|
|
||||||
type RegisterUserCommand = {
|
type RegisterUserCommand = {
|
||||||
@@ -27,7 +28,9 @@ export type RegisterUserResponse = {
|
|||||||
factors: Factors | undefined;
|
factors: Factors | undefined;
|
||||||
};
|
};
|
||||||
export async function registerUser(command: RegisterUserCommand) {
|
export async function registerUser(command: RegisterUserCommand) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -18,12 +18,15 @@ import {
|
|||||||
getSessionCookieByLoginName,
|
getSessionCookieByLoginName,
|
||||||
removeSessionFromCookie,
|
removeSessionFromCookie,
|
||||||
} from "../cookies";
|
} from "../cookies";
|
||||||
|
import { getApiUrlOfHeaders } from "../service";
|
||||||
|
|
||||||
export async function continueWithSession({
|
export async function continueWithSession({
|
||||||
authRequestId,
|
authRequestId,
|
||||||
...session
|
...session
|
||||||
}: Session & { authRequestId?: string }) {
|
}: Session & { authRequestId?: string }) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
@@ -89,7 +92,9 @@ export async function updateSession(options: UpdateSessionCommand) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
return { error: "Could not get host" };
|
return { error: "Could not get host" };
|
||||||
@@ -151,7 +156,9 @@ type ClearSessionOptions = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function clearSession(options: ClearSessionOptions) {
|
export async function clearSession(options: ClearSessionOptions) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
@@ -177,7 +184,9 @@ type CleanupSessionCommand = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function cleanupSession({ sessionId }: CleanupSessionCommand) {
|
export async function cleanupSession({ sessionId }: CleanupSessionCommand) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -6,6 +6,7 @@ import { VerifyU2FRegistrationRequestSchema } from "@zitadel/proto/zitadel/user/
|
|||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
import { userAgent } from "next/server";
|
import { userAgent } from "next/server";
|
||||||
import { getSessionCookieById } from "../cookies";
|
import { getSessionCookieById } from "../cookies";
|
||||||
|
import { getApiUrlOfHeaders } from "../service";
|
||||||
|
|
||||||
type RegisterU2FCommand = {
|
type RegisterU2FCommand = {
|
||||||
sessionId: string;
|
sessionId: string;
|
||||||
@@ -19,7 +20,9 @@ type VerifyU2FCommand = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function addU2F(command: RegisterU2FCommand) {
|
export async function addU2F(command: RegisterU2FCommand) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
@@ -55,7 +58,9 @@ export async function addU2F(command: RegisterU2FCommand) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function verifyU2F(command: VerifyU2FCommand) {
|
export async function verifyU2F(command: VerifyU2FCommand) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
@@ -19,6 +19,7 @@ import { User } from "@zitadel/proto/zitadel/user/v2/user_pb";
|
|||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
import { getNextUrl } from "../client";
|
import { getNextUrl } from "../client";
|
||||||
import { getSessionCookieByLoginName } from "../cookies";
|
import { getSessionCookieByLoginName } from "../cookies";
|
||||||
|
import { getApiUrlOfHeaders } from "../service";
|
||||||
import { loadMostRecentSession } from "../session";
|
import { loadMostRecentSession } from "../session";
|
||||||
import { checkMFAFactors } from "../verify-helper";
|
import { checkMFAFactors } from "../verify-helper";
|
||||||
import { createSessionAndUpdateCookie } from "./cookie";
|
import { createSessionAndUpdateCookie } from "./cookie";
|
||||||
@@ -28,7 +29,9 @@ export async function verifyTOTP(
|
|||||||
loginName?: string,
|
loginName?: string,
|
||||||
organization?: string,
|
organization?: string,
|
||||||
) {
|
) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
@@ -63,7 +66,9 @@ type VerifyUserByEmailCommand = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function sendVerification(command: VerifyUserByEmailCommand) {
|
export async function sendVerification(command: VerifyUserByEmailCommand) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
@@ -245,7 +250,9 @@ type resendVerifyEmailCommand = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function resendVerification(command: resendVerifyEmailCommand) {
|
export async function resendVerification(command: resendVerifyEmailCommand) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host) {
|
if (!host) {
|
||||||
return { error: "No host found" };
|
return { error: "No host found" };
|
||||||
@@ -267,7 +274,6 @@ type sendEmailCommand = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export async function sendEmailCode(command: sendEmailCommand) {
|
export async function sendEmailCode(command: sendEmailCommand) {
|
||||||
const host = (await headers()).get("host");
|
|
||||||
return zitadelSendEmailCode({
|
return zitadelSendEmailCode({
|
||||||
userId: command.userId,
|
userId: command.userId,
|
||||||
host: command.host,
|
host: command.host,
|
||||||
@@ -286,7 +292,9 @@ export type SendVerificationRedirectWithoutCheckCommand = {
|
|||||||
export async function sendVerificationRedirectWithoutCheck(
|
export async function sendVerificationRedirectWithoutCheck(
|
||||||
command: SendVerificationRedirectWithoutCheckCommand,
|
command: SendVerificationRedirectWithoutCheckCommand,
|
||||||
) {
|
) {
|
||||||
const host = (await headers()).get("host");
|
const _headers = await headers();
|
||||||
|
const instanceUrl = getApiUrlOfHeaders(_headers);
|
||||||
|
const host = instanceUrl;
|
||||||
|
|
||||||
if (!host || typeof host !== "string") {
|
if (!host || typeof host !== "string") {
|
||||||
throw new Error("No host found");
|
throw new Error("No host found");
|
||||||
|
Reference in New Issue
Block a user