97cfd0ed90
- Password validation: min(8) → min(12) across auth.ts, user-procedure-support.ts, and invite.ts (aligns with NIST SP 800-63B modern recommendations) - Error boundary: stop rendering raw error.message which could leak internal details; always show the generic fallback text - Add `pnpm audit` script (--audit-level=high) for dependency vulnerability scanning Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
61 lines
1.9 KiB
TypeScript
61 lines
1.9 KiB
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
|
|
export default function AppError({
|
|
error,
|
|
reset,
|
|
}: {
|
|
error: Error & { digest?: string };
|
|
reset: () => void;
|
|
}) {
|
|
useEffect(() => {
|
|
console.error("[AppError]", error);
|
|
}, [error]);
|
|
|
|
return (
|
|
<div className="flex flex-col items-center justify-center min-h-[400px] p-8 text-center">
|
|
<div className="w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center mb-4">
|
|
<svg
|
|
className="w-6 h-6 text-red-600 dark:text-red-400"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
viewBox="0 0 24 24"
|
|
>
|
|
<path
|
|
strokeLinecap="round"
|
|
strokeLinejoin="round"
|
|
strokeWidth={2}
|
|
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
|
/>
|
|
</svg>
|
|
</div>
|
|
<h2 className="text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2">
|
|
Something went wrong
|
|
</h2>
|
|
<p className="text-sm text-gray-500 dark:text-gray-400 mb-6 max-w-sm">
|
|
{"An unexpected error occurred. The team has been notified."}
|
|
</p>
|
|
{error.digest && (
|
|
<p className="text-xs text-gray-400 dark:text-gray-500 mb-4 font-mono">
|
|
Error ID: {error.digest}
|
|
</p>
|
|
)}
|
|
<div className="flex gap-3">
|
|
<button
|
|
onClick={reset}
|
|
className="px-4 py-2 text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 rounded-lg transition-colors"
|
|
>
|
|
Try again
|
|
</button>
|
|
<button
|
|
onClick={() => (window.location.href = "/dashboard")}
|
|
className="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors"
|
|
>
|
|
Go to dashboard
|
|
</button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|