mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-30 16:08:56 +00:00
* fix: Improve host header handling and deployment mode detection * ZITADEL_CLOUD env * refactor service config * service config * cleanup * cleanup * util for original and public host * instanceHost, publicHost * cleanup constructUrl * cleanup middleware * add x-zitadel-forward-host as fallback for current cloud setup * fix build * fix: lint * fix: update test mocks * fix: provide basepath to unit tests * host handling * unit tests * imports * fix: getPublicHost instead of getInstanceHost * unit tests * update nextjs, implement jwt verify for logout_token * pass logout information in jwt to login v2 * handle hosts in jwks url * point idp callbacks to the api and not the login UI * logout_hint out of logout token, typecheck * rm unused imports * fix oidc integration test --------- Co-authored-by: Livio Spring <[email protected]>
93 lines
3.1 KiB
TypeScript
93 lines
3.1 KiB
TypeScript
import { DynamicTheme } from "@/components/dynamic-theme";
|
|
import { SetRegisterPasswordForm } from "@/components/set-register-password-form";
|
|
import { Translated } from "@/components/translated";
|
|
import { getServiceConfig } from "@/lib/service-url";
|
|
import {
|
|
getBrandingSettings,
|
|
getDefaultOrg,
|
|
getLegalAndSupportSettings,
|
|
getLoginSettings,
|
|
getPasswordComplexitySettings,
|
|
} from "@/lib/zitadel";
|
|
import { Organization } from "@zitadel/proto/zitadel/org/v2/org_pb";
|
|
import { headers } from "next/headers";
|
|
|
|
export default async function Page(props: { searchParams: Promise<Record<string | number | symbol, string | undefined>> }) {
|
|
const searchParams = await props.searchParams;
|
|
|
|
let { firstname, lastname, email, organization, requestId } = searchParams;
|
|
|
|
const _headers = await headers();
|
|
const { serviceConfig } = getServiceConfig(_headers);
|
|
|
|
if (!organization) {
|
|
const org: Organization | null = await getDefaultOrg({ serviceConfig, });
|
|
if (org) {
|
|
organization = org.id;
|
|
}
|
|
}
|
|
|
|
const missingData = !firstname || !lastname || !email || !organization;
|
|
|
|
const legal = await getLegalAndSupportSettings({ serviceConfig, organization,
|
|
});
|
|
const passwordComplexitySettings = await getPasswordComplexitySettings({ serviceConfig, organization,
|
|
});
|
|
|
|
const branding = await getBrandingSettings({ serviceConfig, organization,
|
|
});
|
|
|
|
const loginSettings = await getLoginSettings({ serviceConfig, organization,
|
|
});
|
|
|
|
return missingData ? (
|
|
<DynamicTheme branding={branding}>
|
|
<div className="flex flex-col items-center space-y-4">
|
|
<h1>
|
|
<Translated i18nKey="missingdata.title" namespace="register" />
|
|
</h1>
|
|
<p className="ztdl-p">
|
|
<Translated i18nKey="missingdata.description" namespace="register" />
|
|
</p>
|
|
</div>
|
|
<div className="w-full"></div>
|
|
</DynamicTheme>
|
|
) : loginSettings?.allowRegister && loginSettings.allowUsernamePassword ? (
|
|
<DynamicTheme branding={branding}>
|
|
<div className="flex flex-col space-y-4">
|
|
<h1>
|
|
<Translated i18nKey="password.title" namespace="register" />
|
|
</h1>
|
|
<p className="ztdl-p">
|
|
<Translated i18nKey="description" namespace="register" />
|
|
</p>
|
|
</div>
|
|
|
|
<div className="w-full">
|
|
{legal && passwordComplexitySettings && (
|
|
<SetRegisterPasswordForm
|
|
passwordComplexitySettings={passwordComplexitySettings}
|
|
email={email}
|
|
firstname={firstname}
|
|
lastname={lastname}
|
|
organization={organization as string} // organization is guaranteed to be a string here otherwise we would have returned earlier
|
|
requestId={requestId}
|
|
></SetRegisterPasswordForm>
|
|
)}
|
|
</div>
|
|
</DynamicTheme>
|
|
) : (
|
|
<DynamicTheme branding={branding}>
|
|
<div className="flex flex-col space-y-4">
|
|
<h1>
|
|
<Translated i18nKey="disabled.title" namespace="register" />
|
|
</h1>
|
|
<p className="ztdl-p">
|
|
<Translated i18nKey="disabled.description" namespace="register" />
|
|
</p>
|
|
</div>
|
|
<div className="w-full"></div>
|
|
</DynamicTheme>
|
|
);
|
|
}
|