feat: secure KYC storage, Google OAuth, terms gating

This commit is contained in:
arifal
2026-04-28 23:10:21 +07:00
parent 58da4608ac
commit 05d0929f7a
41 changed files with 3087 additions and 262 deletions
+16
View File
@@ -1,7 +1,10 @@
"use server";
import { getServerSession } from "next-auth";
import { authOptions } from "@/lib/auth";
import { registerSchema } from "./schemas";
import { authService } from "@/server/services/auth.service";
import { userRepo } from "@/server/repositories/user.repo";
export async function registerAction(formData: FormData) {
const raw = {
@@ -29,3 +32,16 @@ export async function registerAction(formData: FormData) {
return { error: (err as Error).message };
}
}
export async function acceptTermsAction() {
const session = await getServerSession(authOptions);
if (!session?.user) {
return { error: "Kamu harus login terlebih dahulu" };
}
try {
await userRepo.markAcceptedTerms(session.user.id);
return { success: true };
} catch (err) {
return { error: (err as Error).message };
}
}