import { LoginFormIDP } from "@app/components/LoginForm"; import { LoadLoginPageBrandingResponse, LoadLoginPageResponse } from "@server/routers/loginPage/types"; import IdpLoginButtons from "@app/components/private/IdpLoginButtons"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@app/components/ui/card"; import { Button } from "@app/components/ui/button"; import Link from "next/link"; import { replacePlaceholder } from "@app/lib/replacePlaceholder"; import { getTranslations } from "next-intl/server"; import { pullEnv } from "@app/lib/pullEnv"; type OrgLoginPageProps = { loginPage: LoadLoginPageResponse | undefined; loginIdps: LoginFormIDP[]; branding: LoadLoginPageBrandingResponse | null; searchParams: { redirect?: string; forceLogin?: string; }; }; function buildQueryString(searchParams: { redirect?: string; forceLogin?: string; }): string { const params = new URLSearchParams(); if (searchParams.redirect) { params.set("redirect", searchParams.redirect); } if (searchParams.forceLogin) { params.set("forceLogin", searchParams.forceLogin); } const queryString = params.toString(); return queryString ? `?${queryString}` : ""; } export default async function OrgLoginPage({ loginPage, loginIdps, branding, searchParams }: OrgLoginPageProps) { const env = pullEnv(); const t = await getTranslations(); return (
{t("poweredBy")}{" "} {env.branding.appName || "Pangolin"}
{branding?.logoUrl && (
)} {branding?.orgTitle ? replacePlaceholder(branding.orgTitle, { orgName: branding.orgName }) : t("orgAuthSignInTitle")} {branding?.orgSubtitle ? replacePlaceholder(branding.orgSubtitle, { orgName: branding.orgName }) : loginIdps.length > 0 ? t("orgAuthChooseIdpDescription") : ""}
{loginIdps.length > 0 ? ( ) : (

{t("orgAuthNoIdpConfigured")}

)}
); }