fixed captcha

This commit is contained in:
MathMan05 2024-07-28 15:03:29 -05:00
parent 6cea53dabd
commit 3621f1b09b
3 changed files with 28 additions and 0 deletions

View file

@ -23,6 +23,7 @@ async function registertry(e){
username:username,
password:password,
consent:elements[6].checked,
captcha_key:elements[7]?.value
}),
headers:{
"content-type": "application/json"
@ -30,6 +31,18 @@ async function registertry(e){
method:"POST"
}).then(e=>{
e.json().then(e=>{
if(e.captcha_sitekey){
const capt=document.getElementById("h-captcha");
const capty=document.createElement("div");
capty.classList.add("h-captcha");
capty.setAttribute("data-sitekey", e.captcha_sitekey);
const script=document.createElement("script");
script.src="https://js.hcaptcha.com/1/api.js";
capt.append(script);
capt.append(capty);
return;
}
if(!e.token){
console.log(e);
document.getElementById("wrong").textContent=e.errors[Object.keys(e.errors)[0]]._errors[0].message;