2023-11-28 11:42:37 -08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>login test</title>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
2023-11-28 15:41:16 -08:00
|
|
|
<link href="/root/css/style.css" rel="stylesheet">
|
2023-11-28 11:42:37 -08:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
hiii
|
2023-11-28 15:41:16 -08:00
|
|
|
<form action="/login" method="post" class="login-form" id="login-form">
|
2023-11-28 11:42:37 -08:00
|
|
|
<div class="form-test">
|
|
|
|
<label for="name">Enter your username: </label>
|
|
|
|
<input type="text" name="username" id="name" required />
|
|
|
|
</div>
|
|
|
|
<div class="form-test">
|
|
|
|
<label for="pass">Enter your password: </label>
|
|
|
|
<input type="text" name="password" id="password" required />
|
|
|
|
</div>
|
|
|
|
<div class="form-test">
|
|
|
|
<input type="submit" value="Log in" />
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
<script defer>
|
|
|
|
console.log("FUCK YEAH JAVASCRIPT TIME BABYYYYYYY");
|
2023-11-28 15:41:16 -08:00
|
|
|
document.getElementById("login-form").addEventListener("submit", async (event) => {
|
2023-11-28 11:42:37 -08:00
|
|
|
event.preventDefault();
|
|
|
|
const username = event.target.username.value;
|
|
|
|
const password = event.target.password.value;
|
|
|
|
|
2023-11-28 15:41:16 -08:00
|
|
|
const token = await fetch("/login", {
|
2023-11-28 11:42:37 -08:00
|
|
|
method: "POST",
|
|
|
|
header: {"Content-Type": "application/json"},
|
|
|
|
body: JSON.stringify({username, password})
|
|
|
|
})
|
|
|
|
console.log(await token.text())
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</html>
|