2022-12-22 18:21:12 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
2024-10-11 21:34:27 +08:00
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
<meta
|
|
|
|
name="viewport"
|
|
|
|
content="width=device-width, initial-scale=1, maximum-scale=1"
|
|
|
|
/>
|
|
|
|
<link rel="icon" type="image/x-icon" href="/favicon.png" />
|
|
|
|
<title>Login to SilverBullet</title>
|
|
|
|
<style>
|
|
|
|
html,
|
|
|
|
body {
|
|
|
|
font-family:
|
|
|
|
-apple-system,
|
|
|
|
BlinkMacSystemFont,
|
|
|
|
"Segoe UI",
|
|
|
|
Roboto,
|
|
|
|
"Helvetica Neue",
|
|
|
|
Arial,
|
|
|
|
"Noto Sans",
|
|
|
|
sans-serif,
|
|
|
|
"Apple Color Emoji",
|
|
|
|
"Segoe UI Emoji",
|
|
|
|
"Segoe UI Symbol",
|
|
|
|
"Noto Color Emoji";
|
|
|
|
border: 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
2022-12-22 18:21:12 +08:00
|
|
|
|
2024-10-11 21:34:27 +08:00
|
|
|
footer {
|
|
|
|
margin-top: 10px;
|
|
|
|
}
|
2022-12-22 18:21:12 +08:00
|
|
|
|
2024-10-11 21:34:27 +08:00
|
|
|
header {
|
|
|
|
background-color: #e1e1e1;
|
|
|
|
border-bottom: #cacaca 1px solid;
|
|
|
|
}
|
2022-12-22 18:21:12 +08:00
|
|
|
|
2024-10-11 21:34:27 +08:00
|
|
|
h1 {
|
|
|
|
margin: 0;
|
|
|
|
margin: 0 auto;
|
|
|
|
max-width: 800px;
|
|
|
|
padding: 8px;
|
|
|
|
font-size: 28px;
|
|
|
|
font-weight: normal;
|
|
|
|
}
|
2022-12-22 18:21:12 +08:00
|
|
|
|
2024-10-11 21:34:27 +08:00
|
|
|
form {
|
|
|
|
max-width: 800px;
|
|
|
|
margin: 0 auto;
|
|
|
|
padding: 10px;
|
|
|
|
}
|
2022-12-22 18:21:12 +08:00
|
|
|
|
2024-10-11 21:34:27 +08:00
|
|
|
input {
|
|
|
|
font-size: 18px;
|
|
|
|
}
|
2022-12-22 18:21:12 +08:00
|
|
|
|
2024-10-11 21:34:27 +08:00
|
|
|
form > div {
|
|
|
|
margin-bottom: 5px;
|
|
|
|
}
|
2022-12-22 18:21:12 +08:00
|
|
|
|
2024-10-11 21:34:27 +08:00
|
|
|
.error-message {
|
|
|
|
color: red;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
2022-12-22 18:21:12 +08:00
|
|
|
|
2024-10-11 21:34:27 +08:00
|
|
|
<body>
|
|
|
|
<header>
|
|
|
|
<h1>
|
|
|
|
Login to <img src="/.client/logo.png" style="height: 1ch" />
|
|
|
|
SilverBullet
|
|
|
|
</h1>
|
|
|
|
</header>
|
|
|
|
<form action="/.auth" method="POST" id="login">
|
|
|
|
<div class="error-message"></div>
|
|
|
|
<div>
|
|
|
|
<input
|
|
|
|
type="text"
|
|
|
|
name="username"
|
|
|
|
id="username"
|
|
|
|
autocomplete="off"
|
|
|
|
autocorrect="off"
|
|
|
|
autocapitalize="off"
|
|
|
|
autofocus
|
|
|
|
placeholder="Username"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<input
|
|
|
|
type="password"
|
|
|
|
name="password"
|
|
|
|
id="password"
|
|
|
|
placeholder="Password"
|
|
|
|
/>
|
|
|
|
</div>
|
2024-10-28 21:09:32 +08:00
|
|
|
<div>
|
|
|
|
<input type="checkbox" name="rememberMe" id="rememberMe" />
|
2024-12-31 14:19:17 +08:00
|
|
|
<label for="rememberMe">Remember me</label>
|
2024-10-28 21:09:32 +08:00
|
|
|
</div>
|
2024-10-11 21:34:27 +08:00
|
|
|
<div>
|
|
|
|
<input type="submit" value="Login" />
|
|
|
|
</div>
|
|
|
|
<footer>
|
|
|
|
<a href="https://silverbullet.md">What is SilverBullet?</a>
|
|
|
|
</footer>
|
|
|
|
</form>
|
2022-12-22 18:21:12 +08:00
|
|
|
|
2024-10-11 21:34:27 +08:00
|
|
|
<script>
|
|
|
|
const params = new URLSearchParams(window.location.search);
|
2022-12-22 18:21:12 +08:00
|
|
|
|
2024-10-11 21:34:27 +08:00
|
|
|
const error = params.get("error");
|
|
|
|
if (error === "0") {
|
|
|
|
document.querySelector(".error-message").innerText =
|
|
|
|
"The sent data was invalid";
|
|
|
|
} else if (error === "1") {
|
|
|
|
document.querySelector(".error-message").innerText =
|
|
|
|
"Invalid username or password";
|
2024-11-15 23:51:18 +08:00
|
|
|
} else if (error === "2") {
|
|
|
|
document.querySelector(".error-message").innerText =
|
|
|
|
"Too many invalid logins. Try again later";
|
2024-10-11 21:34:27 +08:00
|
|
|
}
|
2022-12-22 18:21:12 +08:00
|
|
|
|
2024-10-11 21:34:27 +08:00
|
|
|
const from = params.get("from");
|
|
|
|
if (from) {
|
|
|
|
var input = document.createElement("input");
|
|
|
|
input.setAttribute("type", "hidden");
|
|
|
|
input.setAttribute("name", "from");
|
|
|
|
input.setAttribute("value", from);
|
2024-06-22 18:45:23 +08:00
|
|
|
|
2024-10-11 21:34:27 +08:00
|
|
|
document.getElementById("login").appendChild(input);
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|