feat: secure KYC storage, Google OAuth, terms gating
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { authOptions } from "@/lib/auth";
|
||||
import { userRepo } from "@/server/repositories/user.repo";
|
||||
import { AcceptTermsForm } from "./form";
|
||||
|
||||
export default async function AcceptTermsPage() {
|
||||
const session = await getServerSession(authOptions);
|
||||
if (!session?.user) redirect("/login?callbackUrl=/accept-terms");
|
||||
|
||||
// Source of truth = DB (token bisa stale).
|
||||
const user = await userRepo.findById(session.user.id);
|
||||
if (user?.acceptedTermsAndPrivacy) redirect("/");
|
||||
|
||||
return (
|
||||
<div className="mx-auto max-w-xl px-4 py-10 sm:py-16">
|
||||
<h1 className="text-2xl font-bold text-neutral-900 sm:text-3xl">
|
||||
Satu langkah lagi
|
||||
</h1>
|
||||
<p className="mt-2 text-sm text-neutral-600">
|
||||
Sebelum melanjutkan, mohon baca dan setujui Syarat & Ketentuan dan
|
||||
Kebijakan Privasi SeTrip.
|
||||
</p>
|
||||
<AcceptTermsForm />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user