feat(antispam): add server-side contact form spam guard (honeypot, time-trap, rate limit, link cap)

This commit is contained in:
2026-09-01 17:15:40 +02:00
parent db0963a7db
commit 2c51831a81
6 changed files with 165 additions and 7 deletions

View File

@@ -12,6 +12,7 @@ export default function ContactForm() {
const { trackEvent } = useAnalytics();
const [status, setStatus] = useState<'idle' | 'submitting' | 'success' | 'error'>('idle');
const [hasStarted, setHasStarted] = useState(false);
const [formLoadedAt] = useState(() => Date.now());
const handleFocus = (fieldId: string) => {
// Initial form start
@@ -152,6 +153,8 @@ export default function ContactForm() {
style={{ display: 'none' }}
aria-hidden="true"
/>
{/* Anti-spam time-trap: server rejects submissions faster than a human could fill the form */}
<input type="hidden" name="form_loaded_at" value={formLoadedAt} />
<div className="space-y-1 md:space-y-2">
<Label htmlFor="contact-name">{t('form.name')}</Label>
<Input