-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
27 lines (27 loc) · 749 Bytes
/
index.html
File metadata and controls
27 lines (27 loc) · 749 Bytes
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
<!DOCTYPE html>
<html>
<head>
<title>CTF Login</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>Login</h1>
<form id="loginForm">
<input type="text" name="username" placeholder="username"/>
<button type="submit">Login</button>
</form>
<script>
document.getElementById('loginForm').onsubmit = async (e) => {
e.preventDefault();
const username = e.target.username.value;
const res = await fetch('/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username })
});
const json = await res.json();
if (json.ok) window.location = json.next;
};
</script>
</body>
</html>