We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d56fbdc commit 5414e70Copy full SHA for 5414e70
app/routes/-components/newsletter.tsx
@@ -23,11 +23,19 @@ export const subscribeFn = createServerFn()
23
body: `secret=${env.RECAPTCHA_SECRET_KEY}&response=${data.recaptchaToken}`,
24
}
25
);
26
- const json = (await response.json()) as { success: boolean };
+ const json = (await response.json()) as {
27
+ success: boolean;
28
+ score: number;
29
+ };
30
+
31
if (!json.success) {
32
throw new Error("invalid recaptcha token");
33
34
35
+ if (json.score < 0.5) {
36
+ throw new Error("recaptcha score too low");
37
+ }
38
39
const params = new URLSearchParams();
40
params.append("email", data.email);
41
await fetch(env.MAILING_LIST_ENDPOINT, {
0 commit comments