import { DynamicTheme } from "@/components/dynamic-theme"; import { SignInWithIdp } from "@/components/sign-in-with-idp"; import { UsernameForm } from "@/components/username-form"; import { getBrandingSettings, getDefaultOrg, getLoginSettings, settingsService, } from "@/lib/zitadel"; import { makeReqCtx } from "@zitadel/client/v2"; import { Organization } from "@zitadel/proto/zitadel/org/v2/org_pb"; import { getLocale, getTranslations } from "next-intl/server"; function getIdentityProviders(orgId?: string) { return settingsService .getActiveIdentityProviders({ ctx: makeReqCtx(orgId) }, {}) .then((resp) => { return resp.identityProviders; }); } export default async function Page({ searchParams, }: { searchParams: Record; }) { const locale = getLocale(); const t = await getTranslations({ locale, namespace: "loginname" }); const loginName = searchParams?.loginName; const authRequestId = searchParams?.authRequestId; const organization = searchParams?.organization; const submit: boolean = searchParams?.submit === "true"; let defaultOrganization; if (!organization) { const org: Organization | null = await getDefaultOrg(); if (org) { defaultOrganization = org.id; } } const host = process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : "http://localhost:3000"; const loginSettings = await getLoginSettings( organization ?? defaultOrganization, ); const identityProviders = await getIdentityProviders( organization ?? defaultOrganization, ); const branding = await getBrandingSettings( organization ?? defaultOrganization, ); return (

{t("title")}

{t("description")}

{identityProviders && process.env.ZITADEL_API_URL && ( )}
); }