Harden form auth and submission handling

This commit is contained in:
2026-07-09 23:53:40 +07:00 Unverified
parent 2c82d55839
commit 8c0cc4492b
43 changed files with 747 additions and 534 deletions
+2 -10
View File
@@ -11,9 +11,9 @@ import {
} from "@/components/ui/table";
import { Badge } from "@/components/ui/badge";
import { Plus } from "lucide-react";
import { redirect } from "next/navigation";
import { DeleteFormButton } from "@/components/delete-buttons";
import { AdminShellServer } from "@/components/admin-shell-server";
import { createDefaultForm } from "./actions";
export const dynamic = "force-dynamic";
@@ -32,15 +32,7 @@ export default async function AdminFormsPage() {
Manage your custom forms and view submissions.
</p>
</div>
<form action={async () => {
"use server";
const { forms } = await import("@/db/schema");
const [newForm] = await db.insert(forms).values({
title: "New Form",
description: "",
}).returning();
redirect(`/admin/form/${newForm.id}`);
}}>
<form action={createDefaultForm}>
<Button type="submit">
<Plus className="mr-2 h-4 w-4" />
Create Form