Recacpha / index.html
Vibow's picture
Update index.html
a8469df verified
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vibow AI - hCaptcha Test</title>
<script src="https://hcaptcha.com/1/api.js" async defer></script>
<style>
body {
font-family: "Segoe UI", sans-serif;
background: linear-gradient(135deg, #1f1c2c, #928dab);
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
margin: 0;
}
.card {
background: white;
border-radius: 16px;
padding: 32px;
width: 360px;
box-shadow: 0 6px 20px rgba(0,0,0,0.2);
text-align: center;
}
h2 {
margin-bottom: 20px;
color: #333;
}
button {
width: 100%;
padding: 12px;
margin-top: 16px;
border: none;
border-radius: 8px;
background: #4a47a3;
color: white;
font-weight: bold;
cursor: pointer;
}
.loading {
display: none;
margin-top: 12px;
color: #555;
}
.result {
margin-top: 16px;
font-weight: bold;
}
</style>
</head>
<body>
<div class="card">
<h2>Vibow AI Verification</h2>
<div class="h-captcha"
data-sitekey="d2667a10-0862-4a5a-90d8-2fa4ce183d06"
data-callback="setToken"></div>
<button onclick="submitForm()">Verify</button>
<div id="loading" class="loading">⏳ Verifying...</div>
<div id="result" class="result"></div>
</div>
<script>
let captchaToken = "";
function setToken(token) {
captchaToken = token;
console.log("Token received:", token);
}
async function submitForm() {
const loading = document.getElementById("loading");
const result = document.getElementById("result");
if (!captchaToken) {
result.innerHTML = "❌ Please solve the captcha first.";
return;
}
loading.style.display = "block";
result.innerHTML = "";
try {
const response = await fetch("/verify", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({ token: captchaToken })
});
const data = await response.json();
loading.style.display = "none";
if (data.success) {
result.innerHTML = "βœ… Verification success! Opening new tab...";
setTimeout(() => {
window.open("https://talkgte.netlify.app/donate.html", "_blank"); // buka tab baru
}, 1500);
} else {
result.innerHTML = "❌ Failed: " + JSON.stringify(data);
}
} catch (err) {
loading.style.display = "none";
result.innerHTML = "⚠️ Error: " + err.message;
} finally {
// Reset captcha biar token lama gak kepakai lagi
hcaptcha.reset();
captchaToken = "";
}
}
</script>
</body>
</html>