feat : use guide login only [no ci]

This commit is contained in:
2026-10-06 18:41:28 +07:00 Unverified
parent 1339dd43e6
commit 3c8f60433a
28 changed files with 50 additions and 783 deletions
+4 -12
View File
@@ -1,14 +1,12 @@
import { redirect } from "next/navigation";
import { SiteHeader } from "@/components/public/site-header";
import { isAuthorizedAdmin } from "@/lib/auth/authorization";
import { getCustomerSession, isSudlohOidcEnabled } from "@/lib/auth/server";
import { getCustomerSession } from "@/lib/auth/server";
import { safeAuthReturnPath } from "@/lib/auth/return-path";
import { AccountForm } from "./account-form";
import { SudlohSignInRedirect } from "./sudloh-sign-in-redirect";
export async function AccountPage({ mode, next, verified, verificationError, oidcError }: {
export async function AccountPage({ mode, next, verified, verificationError }: {
mode: "login" | "register"; next: unknown; verified?: boolean; verificationError?: boolean;
oidcError?: string;
}) {
const nextPath = safeAuthReturnPath(next);
const session = await getCustomerSession();
@@ -17,15 +15,9 @@ export async function AccountPage({ mode, next, verified, verificationError, oid
redirect(nextPath);
}
const siteKey = process.env.TURNSTILE_SITE_KEY ?? "";
const oidcEnabled = isSudlohOidcEnabled();
const oidcOnly = oidcEnabled && process.env.SUDLOH_OIDC_ONLY === "true";
if (mode === "login" && oidcEnabled && !oidcError) {
return <div className="min-h-svh"><SiteHeader /><SudlohSignInRedirect nextPath={nextPath} /></div>;
}
if (!oidcOnly && process.env.NODE_ENV !== "development" && !siteKey) throw new Error("TURNSTILE_SITE_KEY is required");
if (process.env.NODE_ENV !== "development" && !siteKey) throw new Error("TURNSTILE_SITE_KEY is required");
return <div className="min-h-svh"><SiteHeader /><main className="grid min-h-[calc(100svh-4rem)] place-items-center p-4">
<AccountForm mode={mode} siteKey={siteKey} nextPath={nextPath}
oidcEnabled={oidcEnabled} oidcOnly={oidcOnly}
verified={verified} verificationError={verificationError} oidcError={oidcError} />
verified={verified} verificationError={verificationError} />
</main></div>;
}