Spaces:
Sleeping
Sleeping
Update templates/index.html
Browse files- templates/index.html +21 -15
templates/index.html
CHANGED
|
@@ -1,20 +1,26 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html>
|
| 3 |
-
<head>
|
| 4 |
-
<title>OTP Installer</title>
|
| 5 |
-
</head>
|
| 6 |
<body>
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</body>
|
| 20 |
</html>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html>
|
| 3 |
+
<head><title>OTP Validator</title></head>
|
|
|
|
|
|
|
| 4 |
<body>
|
| 5 |
+
<h2>🔐 OTP Validator</h2>
|
| 6 |
+
<form id="otp-form">
|
| 7 |
+
<input type="text" name="otp" placeholder="Enter OTP" required />
|
| 8 |
+
<button type="submit">Validate</button>
|
| 9 |
+
</form>
|
| 10 |
+
<div id="result"></div>
|
| 11 |
+
|
| 12 |
+
<script>
|
| 13 |
+
document.getElementById("otp-form").onsubmit = async (e) => {
|
| 14 |
+
e.preventDefault();
|
| 15 |
+
const otp = e.target.otp.value;
|
| 16 |
+
const res = await fetch("/validate", {
|
| 17 |
+
method: "POST",
|
| 18 |
+
headers: {"Content-Type": "application/json"},
|
| 19 |
+
body: JSON.stringify({otp}),
|
| 20 |
+
});
|
| 21 |
+
const data = await res.json();
|
| 22 |
+
document.getElementById("result").innerText = data.message;
|
| 23 |
+
};
|
| 24 |
+
</script>
|
| 25 |
</body>
|
| 26 |
</html>
|