mirror of
https://github.com/4ev-link/4ev.link.git
synced 2026-01-14 08:38:39 +00:00
Refactor: Switch signup to Turnstile verification
This commit is contained in:
@@ -13,13 +13,13 @@ const ntfy = (env,title,msg,p=3) =>
|
|||||||
|
|
||||||
export async function onRequestPost({ request, env }) {
|
export async function onRequestPost({ request, env }) {
|
||||||
try {
|
try {
|
||||||
const { "g-recaptcha-response":token, ...body } = await request.json();
|
const { "cf-turnstile-response":token, ...body } = await request.json();
|
||||||
const vR = await fetch(
|
const vR = await fetch(
|
||||||
"https://www.google.com/recaptcha/api/siteverify",
|
"https://challenges.cloudflare.com/turnstile/v0/siteverify",
|
||||||
{
|
{
|
||||||
method:"POST",
|
method:"POST",
|
||||||
headers:{ "Content-Type":"application/x-www-form-urlencoded" },
|
headers:{ "Content-Type":"application/json" },
|
||||||
body:`secret=${env.RECAPCHA_KEY}&response=${token}`
|
body:JSON.stringify({ secret:env.TURNSTILE_KEY, response:token })
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (!(await vR.json()).success)
|
if (!(await vR.json()).success)
|
||||||
|
|||||||
Reference in New Issue
Block a user