0vergeared commited on
Commit
0883572
·
verified ·
1 Parent(s): d9fbe52

Update templates/index.html

Browse files
Files changed (1) hide show
  1. 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
- <h2>Enter OTP to Proceed</h2>
8
- <form method="POST">
9
- <input type="text" name="otp" placeholder="Enter OTP" required />
10
- <button type="submit">Verify</button>
11
- </form>
12
- {% with messages = get_flashed_messages(with_categories=true) %}
13
- {% for category, message in messages %}
14
- <p style="color: {% if category == 'success' %}green{% else %}red{% endif %};">{{ message }}</p>
15
- {% endfor %}
16
- {% endwith %}
17
- <hr>
18
- <a href="/admin">Admin Login</a>
 
 
 
 
 
 
 
 
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>