-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.html
executable file
·46 lines (43 loc) · 1.44 KB
/
index.html
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
41
42
43
44
45
46
<html>
<head>
<title>Login required</title>
<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed:300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="/login/css/style.css" />
<meta charset="utf-8"/>
<script type="text/javascript">
function tryLogin(form) {
let error = document.getElementById("error");
error.classList.remove('show');
//Make the POST XHR instead
fetch("", {
method: "POST",
body: new URLSearchParams(new FormData(form))
}).then(response => {
if (response.status == 401) {
throw new Error(`Got status ${response.status}`);
}
//Expect success.json to be returned on correct
return response.json();
}).then(data => {
if (data.login) {
document.location.reload();
}
}).catch(e => {
error.classList.add('show');
});
return false;
}
</script>
</head>
<body>
<div id="content">
<h1>Ah ah ah, you didn't say the magic word</h1>
<form method="POST" action="" onsubmit="return tryLogin(this)">
<label for="username">Username</label><input type="text" id="username" name="httpd_username" value="friends" />
<label for="password">Password</label><input type="password" id="password" name="httpd_password" value="" autofocus="true" />
<input type="submit" name="login" value="Login" />
</form>
<p id="error">Please! God damn it! I hate this hacker crap!</p>
</div>
</body>
</html>