Create public/index.html
Browse files- public/index.html +38 -0
public/index.html
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE 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>Login</title>
|
| 7 |
+
</head>
|
| 8 |
+
<body>
|
| 9 |
+
<form id="loginForm">
|
| 10 |
+
<input type="text" id="username" placeholder="Username" required>
|
| 11 |
+
<input type="password" id="password" placeholder="Password" required>
|
| 12 |
+
<button type="submit">Login</button>
|
| 13 |
+
</form>
|
| 14 |
+
|
| 15 |
+
<script>
|
| 16 |
+
document.getElementById("loginForm").addEventListener("submit", async (event) => {
|
| 17 |
+
event.preventDefault();
|
| 18 |
+
|
| 19 |
+
const username = document.getElementById("username").value;
|
| 20 |
+
const password = document.getElementById("password").value;
|
| 21 |
+
|
| 22 |
+
const response = await fetch("/login", {
|
| 23 |
+
method: "POST",
|
| 24 |
+
headers: { "Content-Type": "application/json" },
|
| 25 |
+
body: JSON.stringify({ username, password }),
|
| 26 |
+
});
|
| 27 |
+
|
| 28 |
+
const message = await response.text();
|
| 29 |
+
alert(message);
|
| 30 |
+
|
| 31 |
+
if (response.ok) {
|
| 32 |
+
// Redirect to terminal page
|
| 33 |
+
window.location.href = "/terminal.html";
|
| 34 |
+
}
|
| 35 |
+
});
|
| 36 |
+
</script>
|
| 37 |
+
</body>
|
| 38 |
+
</html>
|