feat(ui): Benutzer mit Rollen, Anmeldung mit Passwort, erste Einrichtung (#1062)

Argon2id, Standard-Admin mit Einmalpasswort in Datei, eigener Admin bei der
ersten Einrichtung, Rollen admin und nutzer, Benutzerverwaltung, Mein Konto,
nexus user. Die Anmeldung mit API-Key an der Oberfläche entfällt.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GmHhg3osejhFSpUz472iQ1
This commit is contained in:
2026-11-16 13:59:01 +01:00
parent e1c53aaee4
commit 993172d03e
26 changed files with 1684 additions and 137 deletions

View File

@ -48,7 +48,7 @@ fn button(
/// Zeichen für Knöpfe (Linien in der Textfarbe; Inline-SVG ist mit der CSP erlaubt).
const ICON_PLAY: &str = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><polygon points=\"7 4 20 12 7 20 7 4\"/></svg>";
const ICON_STOP: &str = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><rect x=\"6\" y=\"6\" width=\"12\" height=\"12\" rx=\"2\"/></svg>";
const ICON_EDIT: &str = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M12 20h9\"/><path d=\"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z\"/></svg>";
pub(super) const ICON_EDIT: &str = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M12 20h9\"/><path d=\"M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z\"/></svg>";
const ICON_LOCK: &str = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><rect x=\"5\" y=\"11\" width=\"14\" height=\"9\" rx=\"2\"/><path d=\"M8 11V8a4 4 0 0 1 8 0v3\"/></svg>";
const ICON_UNLOCK: &str = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><rect x=\"5\" y=\"11\" width=\"14\" height=\"9\" rx=\"2\"/><path d=\"M8 11V8a4 4 0 0 1 7.5-1.5\"/></svg>";
@ -660,9 +660,7 @@ fn keys_body(state: &AppState, viewer: &Viewer, top: &str) -> String {
rights.push_str(&format!("<span class=\"chip\">{name}</span> "));
}
}
let action = if k.name == viewer.key.name {
"<span class=\"klein\">eigener Key</span>".to_string()
} else if k.active {
let action = if k.active {
icon_button(
viewer,
"/ui/keys/status",
@ -703,7 +701,7 @@ fn keys_body(state: &AppState, viewer: &Viewer, top: &str) -> String {
.list_api_keys()
.unwrap_or_default()
.iter()
.filter(|k| !k.active && k.name != viewer.key.name)
.filter(|k| !k.active)
.map(|k| {
format!(
"<dialog class=\"dialog\" id=\"{id}\" aria-labelledby=\"{id}-t\">\
@ -858,9 +856,6 @@ pub(super) async fn key_status(
};
let name = form_field(&body, "name").unwrap_or_default();
let active = form_field(&body, "an").as_deref() == Some("1");
if name == viewer.key.name {
return back("/ui/keys", "eigener_key");
}
if !state
.store()
.set_api_key_active(&name, active)
@ -891,9 +886,6 @@ pub(super) async fn key_remove(
Err(response) => return *response,
};
let name = form_field(&body, "name").unwrap_or_default();
if name == viewer.key.name {
return back("/ui/keys", "eigener_key");
}
if form_field(&body, "bestaetigt").as_deref() != Some("1") {
return back("/ui/keys", "eingabe");
}