This commit is contained in:
yesmore committed 2024-04-05 15:12:06 +08:00
1 parent c3dfbdd44b
commit bf99b542ea
1 file changed
+26 -26
+26 -26
View File
@@ -83,32 +83,32 @@ export const action: ActionFunction = async ({ request }) => {
});
}
} else if (_action === "create") {
const response = (await request.formData()).get("cf-turnstile-response");
if (!response) {
return {
error: "No captcha response",
};
}
const verifyEndpoint =
"https://challenges.cloudflare.com/turnstile/v0/siteverify";
const secret =
process.env.TURNSTILE_SECRET || "1x0000000000000000000000000000000AA";
const resp = await fetch(verifyEndpoint, {
method: "POST",
body: JSON.stringify({
secret,
response,
}),
headers: {
"Content-Type": "application/json",
},
});
const data = await resp.json();
if (!data.success) {
return {
error: "Failed to verify captcha",
};
}
// const response = (await request.formData()).get("cf-turnstile-response");
// if (!response) {
// return {
// error: "No captcha response",
// };
// }
// const verifyEndpoint =
// "https://challenges.cloudflare.com/turnstile/v0/siteverify";
// const secret =
// process.env.TURNSTILE_SECRET || "1x0000000000000000000000000000000AA";
// const resp = await fetch(verifyEndpoint, {
// method: "POST",
// body: JSON.stringify({
// secret,
// response,
// }),
// headers: {
// "Content-Type": "application/json",
// },
// });
// const data = await resp.json();
// if (!data.success) {
// return {
// error: "Failed to verify captcha",
// };
// }
const domain = process.env.EMAIL_DOMAIN || "";
if (!domain) {