2026-07-11 23:37:48 +08:00

28 lines
1.5 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { redirect } from "next/navigation";
import { AccountAuthForm } from "@/components/account-auth-form";
import { getCaregiverSession, sanitizeCaregiverRedirectPath } from "@/lib/session";
export const dynamic = "force-dynamic";
export default async function LoginPage({ searchParams }: PageProps<"/login">) {
const caregiver = await getCaregiverSession();
const raw = (await searchParams).redirectTo;
const redirectTo = sanitizeCaregiverRedirectPath(typeof raw === "string" ? raw : null);
if (caregiver) redirect(redirectTo);
return (
<main className="app-frame" style={{ display: "flex", alignItems: "center" }}>
<section style={{ width: "100%", padding: "28px 22px", display: "flex", flexDirection: "column", gap: 22 }}>
<div>
<div style={{ display: "flex", width: 52, height: 52, alignItems: "center", justifyContent: "center", borderRadius: 14, background: "var(--accent)", color: "#fff", fontSize: 22, fontWeight: 700 }}></div>
<h1 style={{ margin: "16px 0 0", fontSize: 24, lineHeight: 1.35 }}> </h1>
<p style={{ margin: "8px 0 0", color: "var(--muted)", fontSize: 13.5, lineHeight: 1.7 }}></p>
</div>
<AccountAuthForm redirectTo={redirectTo} />
<p className="muted-note" style={{ textAlign: "center" }}></p>
</section>
</main>
);
}