Implements the from-scratch multi-server WireGuard management fork per CLAUDE.md spec: sqlite schema (servers/peers/audit_log/users), Curve25519 key generation, per-interface config rendering + wg-quick/systemd control, nftables hook scaffolding, session+CSRF-protected REST API with QR code and config download endpoints, a minimal vanilla-JS web UI, legacy wg0.conf migration, and both a native installer and a Proxmox LXC provisioning script (with auto-detected latest Debian template). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
26 lines
761 B
JavaScript
26 lines
761 B
JavaScript
document.getElementById("login-form").addEventListener("submit", async function (e) {
|
|
e.preventDefault();
|
|
const errEl = document.getElementById("login-error");
|
|
errEl.textContent = "";
|
|
|
|
const form = e.target;
|
|
const username = form.username.value;
|
|
const password = form.password.value;
|
|
|
|
try {
|
|
const res = await fetch("/api/login", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ username, password }),
|
|
});
|
|
if (!res.ok) {
|
|
const data = await res.json().catch(() => ({}));
|
|
errEl.textContent = data.error || "Anmeldung fehlgeschlagen.";
|
|
return;
|
|
}
|
|
window.location.href = "/";
|
|
} catch (err) {
|
|
errEl.textContent = "Verbindung fehlgeschlagen.";
|
|
}
|
|
});
|