fix(forms): Naprawa formularza multisplit i dodanie reCAPTCHA v3 do wszystkich formularzy

This commit is contained in:
MichalC
2026-07-27 21:45:32 +02:00
parent 17a43fc6d6
commit e338c95da0
10 changed files with 223 additions and 16 deletions
+9
View File
@@ -0,0 +1,9 @@
export async function verifyRecaptcha(token: string): Promise<{ success: boolean; score?: number }> {
const res = await fetch('https://www.google.com/recaptcha/api/siteverify', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `secret=${process.env.RECAPTCHA_SECRET_KEY}&response=${token}`,
});
const data = await res.json();
return { success: data.success && (data.score === undefined || data.score >= 0.5), score: data.score };
}