Files
passport/src/templates/views/admin/login.hbs
Zoe 68284bc963
Some checks failed
Build and Push Docker Image to GHCR / build-and-push (push) Failing after 25m29s
V0.3.3: Even more optimization
In this realease, I have further optimized Passport. The css that
Passport now uses is entirely handrolled and build via postcss (sadly).
Several bugs have also been fixed in this release, as well as a few
performance improvements relating to the admin UI.
2025-10-05 16:34:39 -05:00

59 lines
1.7 KiB
Handlebars

<!DOCTYPE html>
<html lang="en">
<head>
<title>Passport</title>
<link rel="favicon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="preload" as="font" type="font/woff2" crossorigin="anonymous"
href="/assets/fonts/InstrumentSans-VariableFont_wdth,wght.woff2" />
{{{embedFile "assets/styles/login.css"}}}
</head>
<body>
<main class="login-container">
<img src="/assets/leaves.webp" />
<div>
<h2>
Login
</h2>
<form action="/admin/login" method="post" class="login-form">
<input type="text" name="username" placeholder="Username" />
<input type="password" name="password" placeholder="Password" />
<button class="px-4 py-2 rounded-md w-full bg-accent text-white border-0" type="submit">Login</button>
</form>
<span id="message"></span>
</div>
</main>
</body>
<script>
let message = document.getElementById("message");
let form = document.querySelector("form");
form.addEventListener("submit", async (event) => {
event.preventDefault();
let data = {
"username": form.username.value,
"password": form.password.value
};
console.log(data);
let res = await fetch("/admin/login", {
method: "POST",
body: JSON.stringify(data),
headers: {
"Content-Type": "application/json"
}
});
if (res.status === 200) {
window.location.href = "/admin";
return;
}
message.innerText = (await res.json()).message;
});
</script>
{{{devContent}}}
</html>