blob: d1dbe1d849c4cb1065c141ec92c7d1f0fc5974bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
<!doctype html>
<html lang="en">
<head>
<title>Mark's Database - Login</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" type="text/css" href="/css/styles.css">
<script>
function sendPost(){
let username = document.getElementById('username').value;
let password = document.getElementById('password').value;
fetch(new Request("/login", {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({'username':username, 'password':password})
}))
.then((response) => {
console.log(response);
window.location = "/";
});
}
</script>
</head>
<body>
<div>
<h1>Login</h1>
<div class="form">
<input type="text" placeholder="Enter Username" name="username" id="username" required>
<input type="password" placeholder="Enter Password" name="password" id="password" required>
<button onclick="sendPost()">Log in</button>
</div>
</div>
</body>
</html>
|