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
+11 -16
View File
@@ -3,28 +3,23 @@
import Link from "next/link";
import Image from "next/image";
import { Button } from "@/components/ui/button";
import { useEffect, useState } from "react";
import { useState } from "react";
import { Spinner } from "@/components/ui/spinner";
import Background from "@/public/404.png";
import Profile from "@/public/404-image.jpg";
import { Activity, Home } from "lucide-react";
import { Skeleton } from "@/components/ui/skeleton";
const MESSAGES = [
"ฟอร์มนี้อาจจะถูก Erika กินไปแล้ว...",
"หรือว่าฟอร์มนี้โดน Sukuna เล่นไปแล้ว...",
"ฟอร์มนี้อาจจะหมดอายุหรือโดนลบไปแล้ว...",
"บางทีคนสร้างอาจจะลืมเปิดฟอร์มนะ...",
"ฟอร์มหายไปไหนน้า... ลองเช็คลิงก์ดูอีกทีสิ",
];
export default function NotFound() {
const [goingHome, goHome] = useState(false);
const [message, setMessage] = useState("");
useEffect(() => {
const messages = [
"ฟอร์มนี้อาจจะถูก Erika กินไปแล้ว...",
"หรือว่าฟอร์มนี้โดน Sukuna เล่นไปแล้ว...",
"ฟอร์มนี้อาจจะหมดอายุหรือโดนลบไปแล้ว...",
"บางทีคนสร้างอาจจะลืมเปิดฟอร์มนะ...",
"ฟอร์มหายไปไหนน้า... ลองเช็คลิงก์ดูอีกทีสิ",
];
setMessage(messages[Math.floor(Math.random() * messages.length)]);
}, []);
const [message] = useState(() => MESSAGES[Math.floor(Math.random() * MESSAGES.length)]);
return (
<div className="relative flex min-h-screen w-full flex-col items-center justify-center gap-2">
@@ -45,7 +40,7 @@ export default function NotFound() {
/>
</div>
<h2 className="text-2xl font-semibold">404 ไม่พบหน้านี้</h2>
<span>{message || <Skeleton className="h-6 w-40" />}</span>
<span>{message}</span>
<div className="flex gap-2">
<Link href="/">
<Button