Vibow commited on
Commit
e18c689
Β·
verified Β·
1 Parent(s): a048b2d

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +86 -20
index.html CHANGED
@@ -2,36 +2,102 @@
2
  <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
5
- <title>hCaptcha Test</title>
 
6
  <script src="https://hcaptcha.com/1/api.js" async defer></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  </head>
8
- <body style="font-family:sans-serif; text-align:center; margin-top:50px;">
 
 
9
 
10
- <h2>πŸ”’ hCaptcha Demo (Flat Structure)</h2>
11
 
12
- <div class="h-captcha"
13
- data-sitekey="d2667a10-0862-4a5a-90d8-2fa4ce183d06"
14
- data-callback="sendToken"></div>
15
-
16
- <h3>Result:</h3>
17
- <pre id="result" style="border:1px solid #ccc; padding:10px; width:80%; margin:auto; background:#f9f9f9;"></pre>
18
 
19
  <script>
20
- async function sendToken(token) {
21
- console.log("hCaptcha Token:", token);
 
 
 
 
22
 
23
- let formData = new FormData();
24
- formData.append("token", token);
 
25
 
26
- let response = await fetch("/verify", {
27
- method: "POST",
28
- body: formData
29
- });
30
 
31
- let result = await response.json();
32
- document.getElementById("result").textContent = JSON.stringify(result, null, 2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  }
34
  </script>
35
-
36
  </body>
37
  </html>
 
2
  <html lang="en">
3
  <head>
4
  <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Vibow AI - hCaptcha Test</title>
7
  <script src="https://hcaptcha.com/1/api.js" async defer></script>
8
+ <style>
9
+ body {
10
+ font-family: "Segoe UI", sans-serif;
11
+ background: linear-gradient(135deg, #1f1c2c, #928dab);
12
+ height: 100vh;
13
+ display: flex;
14
+ justify-content: center;
15
+ align-items: center;
16
+ margin: 0;
17
+ }
18
+ .card {
19
+ background: white;
20
+ border-radius: 16px;
21
+ padding: 32px;
22
+ width: 360px;
23
+ box-shadow: 0 6px 20px rgba(0,0,0,0.2);
24
+ text-align: center;
25
+ }
26
+ h2 {
27
+ margin-bottom: 20px;
28
+ color: #333;
29
+ }
30
+ button {
31
+ width: 100%;
32
+ padding: 12px;
33
+ margin-top: 16px;
34
+ border: none;
35
+ border-radius: 8px;
36
+ background: #4a47a3;
37
+ color: white;
38
+ font-weight: bold;
39
+ cursor: pointer;
40
+ }
41
+ .loading {
42
+ display: none;
43
+ margin-top: 12px;
44
+ color: #555;
45
+ }
46
+ .result {
47
+ margin-top: 16px;
48
+ font-weight: bold;
49
+ }
50
+ </style>
51
  </head>
52
+ <body>
53
+ <div class="card">
54
+ <h2>Vibow AI Verification</h2>
55
 
56
+ <div class="h-captcha" data-sitekey="d2667a10-0862-4a5a-90d8-2fa4ce183d06" data-callback="setToken"></div>
57
 
58
+ <button onclick="submitForm()">Verify</button>
59
+ <div id="loading" class="loading">⏳ Verifying...</div>
60
+ <div id="result" class="result"></div>
61
+ </div>
 
 
62
 
63
  <script>
64
+ let captchaToken = "";
65
+
66
+ function setToken(token) {
67
+ captchaToken = token;
68
+ console.log("Token received:", token);
69
+ }
70
 
71
+ async function submitForm() {
72
+ const loading = document.getElementById("loading");
73
+ const result = document.getElementById("result");
74
 
75
+ if (!captchaToken) {
76
+ result.innerHTML = "❌ Please solve the captcha first.";
77
+ return;
78
+ }
79
 
80
+ loading.style.display = "block";
81
+ result.innerHTML = "";
82
+
83
+ try {
84
+ const response = await fetch("/verify", {
85
+ method: "POST",
86
+ headers: {"Content-Type": "application/json"},
87
+ body: JSON.stringify({ token: captchaToken })
88
+ });
89
+ const data = await response.json();
90
+ loading.style.display = "none";
91
+ if (data.success) {
92
+ result.innerHTML = "βœ… Verification success!";
93
+ } else {
94
+ result.innerHTML = "❌ Failed: " + JSON.stringify(data);
95
+ }
96
+ } catch (err) {
97
+ loading.style.display = "none";
98
+ result.innerHTML = "⚠️ Error: " + err.message;
99
+ }
100
  }
101
  </script>
 
102
  </body>
103
  </html>