Files
playwish/server/app/static/login.js
T
99admandClaude Opus 5.5 fc15f2b933 Umbenennung: Audiofy heißt jetzt Playwish
Name, Seitentitel, Dienste (playwish-web, playwish-controller), Dienst-Benutzer
(playwish), Pfade (/opt/playwish, /usr/local/src/playwish), Vorlagen und
Repository-Adresse. „Audiofy“ war bereits von mehreren Produkten belegt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 20:27:59 +01:00

36 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Playwish – Admin-Login
"use strict";
let schutz = { token: async () => null, reset() {}, bereit: () => true }; // Turnstile (falls aktiv)
window.PlaywishTurnstile.einrichten(document.getElementById("turnstile"), "login").then((s) => { schutz = s; });
document.getElementById("login").addEventListener("submit", async (ereignis) => {
ereignis.preventDefault();
const fehler = document.getElementById("fehler");
const knopf = ereignis.target.querySelector("button");
fehler.textContent = "";
knopf.disabled = true;
try {
if (!schutz.bereit()) knopf.textContent = "Sicherheitsprüfung …";
const turnstile = await schutz.token();
knopf.textContent = "Anmelden …";
const antwort = await fetch("/admin/login", {
method: "POST",
credentials: "same-origin",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ password: document.getElementById("passwort").value, turnstile }),
}).finally(() => schutz.reset());
if (antwort.ok) {
location.href = "/admin";
return;
}
let meldung = "Anmeldung fehlgeschlagen.";
try { meldung = (await antwort.json()).detail || meldung; } catch (_) { /* leer */ }
fehler.textContent = meldung;
} catch (_) {
fehler.textContent = "Keine Verbindung zum Server.";
}
knopf.textContent = "Anmelden";
knopf.disabled = false;
});