Hi Giri,
as requested, this the code, when I click the button, the recaptcha work but the database don’t get updated, and if I link the button to the DB, it will get updated regardless of the recaptcha working or not
How can I fix this, please?
import {
verifyCaptcha
}
from ‘backend/recaptcha’;
let gToken = “”;
let strIpAddress = “”;
$w.onReady( async function () {
strIpAddress= await chkIpAddress ();
$w("#frmReCaptcha").onMessage((event) => {
if (event) {
gToken = event.data;
}
});
});
export async function btnSubmit_click(event, $w) {
let boolOK= await verifyCaptcha(gToken, strIpAddress);
if (boolOK) {
console.log("Verification result = " + boolOK);
//todo: redirect to page or show box or show a message
}
}
export async function chkIpAddress() {
const httpResponse = await fetch(‘https://extreme-ip-lookup.com/json’, {
method: ‘get’
});
if (httpResponse.ok) {
const json = await httpResponse.json();
const ipaddress = await json.query;
return ipaddress;
}
}
