mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-08 05:56:38 +00:00
32 lines
788 B
TypeScript
32 lines
788 B
TypeScript
import VerifyEmailForm from "@app/app/auth/verify-email/VerifyEmailForm";
|
|
import { verifySession } from "@app/lib/auth/verifySession";
|
|
import { redirect } from "next/navigation";
|
|
|
|
export default async function Page(props: {
|
|
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
|
|
}) {
|
|
if (!process.env.NEXT_PUBLIC_FLAGS_EMAIL_VERIFICATION_REQUIRED) {
|
|
redirect("/");
|
|
}
|
|
|
|
const searchParams = await props.searchParams;
|
|
const user = await verifySession();
|
|
|
|
if (!user) {
|
|
redirect("/");
|
|
}
|
|
|
|
if (user.emailVerified) {
|
|
redirect("/");
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<VerifyEmailForm
|
|
email={user.email}
|
|
redirect={searchParams.redirect as string}
|
|
/>
|
|
</>
|
|
);
|
|
}
|