- Zugangsdaten (SSH-Logins) als eigenstaendige, wiederverwendbare Entitaet statt direkt am Switch; inline Neuanlage beim Switch-Erstellen moeglich; automatische Migration bestehender Switch-Logins - Gruppen-Seite als Tabelle mit Aufklapp-Zeile fuer Rechte (Akkordeon), Admin als feste Systemzeile (Mitgliederverwaltung ueber is_admin), Standardgruppe 'Benutzer' mit allen Ansichtsrechten (devices.view, switches.view), automatische Zuordnung neuer/verwaister Benutzer - Users-Seite: Icon-Buttons statt Text, Bearbeiten+Passwortaenderung in einem Modal zusammengefuehrt, Gruppe/Admin-Zuweisung ueber eigenen Zuweisen-Button (wie Switch-Zuordnung bei Devices), Vor-/Nachname - Dashboard: einheitliche Kachelansicht mit/ohne Login, drei sortierte Abschnitte (Offline/Online/Deaktiviert), Kachel-Suchfilter, Bootstrap- artiges Grid (max. 6 Spalten), Aktivieren-Option im Popup fuer deaktivierte Geraete, Countdown serverseitig korrekt geseedet - Sidebar dauerhaft einklappbar (Desktop, persistent via localStorage) - Devices-Tabelle: Aktions-Buttons nebeneinander statt untereinander Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
158 lines
6.7 KiB
HTML
158 lines
6.7 KiB
HTML
{% extends "base.html" %}
|
|
{% set active_page = "credentials" %}
|
|
{% set can_create = current_user.has_permission('switches.create') %}
|
|
{% set can_edit = current_user.has_permission('switches.edit') %}
|
|
{% set can_delete = current_user.has_permission('switches.delete') %}
|
|
{% block page_title %}Zugangsdaten{% endblock %}
|
|
{% block page_sub %}<div class="topbar-sub">{{ credentials|length }} Zugangsdaten</div>{% endblock %}
|
|
{% block topbar_right %}
|
|
{% if can_create %}
|
|
<button type="button" class="btn btn-primary" data-open-modal="addCredentialModal">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M12 5v14M5 12h14"/></svg>
|
|
Neue Zugangsdaten
|
|
</button>
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
|
|
<p class="text-faint" style="font-size:12.5px; margin-bottom:18px; max-width:720px;">
|
|
Zugangsdaten können mehreren Switchen gleichzeitig zugeordnet werden. Beim Anlegen eines
|
|
Switches lassen sich bestehende Zugangsdaten auswählen oder direkt neue hinterlegen.
|
|
</p>
|
|
|
|
<div class="table-wrap">
|
|
<div style="overflow-x:auto;">
|
|
<table class="data-table">
|
|
<thead><tr><th>Name</th><th>Username</th><th>Verwendet von</th><th style="width:1%;">Aktionen</th></tr></thead>
|
|
<tbody>
|
|
{% for c in credentials %}
|
|
<tr>
|
|
<td class="cell-name">{{ c['name'] }}</td>
|
|
<td class="mono">{{ c['username'] }}</td>
|
|
<td class="text-dim">{{ c['switch_count'] }} Switch{{ 'e' if c['switch_count'] != 1 else '' }}</td>
|
|
<td>
|
|
<div class="row-actions">
|
|
{% if can_edit %}
|
|
<button class="icon-btn" title="Bearbeiten"
|
|
onclick="openEditCredentialModal({{ c['id'] }}, '{{ c['name'] }}', '{{ c['username'] }}')">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 013 3L7 19l-4 1 1-4z"/></svg>
|
|
</button>
|
|
{% endif %}
|
|
{% if can_delete %}
|
|
<form method="post" data-confirm="Zugangsdaten „{{ c['name'] }}“ wirklich löschen?">
|
|
<input type="hidden" name="delete_credential" value="{{ c['id'] }}">
|
|
<button type="submit" class="icon-btn" style="color:var(--danger);" title="Löschen">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18M8 6V4a2 2 0 012-2h4a2 2 0 012 2v2m3 0l-1 14a2 2 0 01-2 2H7a2 2 0 01-2-2L4 6"/></svg>
|
|
</button>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% else %}
|
|
<tr class="empty-row"><td colspan="4">Noch keine Zugangsdaten vorhanden.</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
{% if can_create %}
|
|
<!-- Modal: Neue Zugangsdaten -->
|
|
<div class="modal-overlay" id="addCredentialModal">
|
|
<div class="modal" style="max-width:380px;">
|
|
<form method="post" onsubmit="return validateCredentialForm(this, 'add');">
|
|
<div class="modal-header">
|
|
<h3>Neue Zugangsdaten</h3>
|
|
<button type="button" class="modal-close" data-close-modal>×</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<input type="hidden" name="add_credential" value="1">
|
|
<div class="field"><label>Name</label>
|
|
<input type="text" name="name" required placeholder="z.B. Standard-Switch-Login">
|
|
</div>
|
|
<div class="field"><label>Username</label>
|
|
<input type="text" name="username" required placeholder="z.B. admin">
|
|
</div>
|
|
<div class="field"><label>Passwort</label>
|
|
<input type="password" id="password_add" name="password" required>
|
|
</div>
|
|
<div class="field"><label>Passwort bestätigen</label>
|
|
<input type="password" id="password_confirm_add" name="password_confirm" required>
|
|
<div class="invalid-feedback">Passwörter stimmen nicht überein!</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-close-modal>Abbrechen</button>
|
|
<button type="submit" class="btn btn-primary">Anlegen</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if can_edit %}
|
|
<!-- Modal: Zugangsdaten bearbeiten -->
|
|
<div class="modal-overlay" id="editCredentialModal">
|
|
<div class="modal" style="max-width:380px;">
|
|
<form method="post" onsubmit="return validateCredentialForm(this, 'edit');">
|
|
<input type="hidden" name="edit_credential" value="1">
|
|
<input type="hidden" name="credential_id" id="edit_cred_id">
|
|
<div class="modal-header">
|
|
<h3>Zugangsdaten bearbeiten</h3>
|
|
<button type="button" class="modal-close" data-close-modal>×</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="field"><label>Name</label>
|
|
<input type="text" name="name" id="edit_cred_name" required>
|
|
</div>
|
|
<div class="field"><label>Username</label>
|
|
<input type="text" name="username" id="edit_cred_username" required>
|
|
</div>
|
|
<div class="field"><label>Neues Passwort</label>
|
|
<input type="password" id="password_edit" name="password" placeholder="Nur bei Änderung ausfüllen">
|
|
</div>
|
|
<div class="field"><label>Passwort bestätigen</label>
|
|
<input type="password" id="password_confirm_edit" name="password_confirm" placeholder="Bestätigen">
|
|
<div class="invalid-feedback">Passwörter stimmen nicht überein!</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-close-modal>Abbrechen</button>
|
|
<button type="submit" class="btn btn-primary">Speichern</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script>
|
|
function openEditCredentialModal(id, name, username) {
|
|
document.getElementById("edit_cred_id").value = id;
|
|
document.getElementById("edit_cred_name").value = name;
|
|
document.getElementById("edit_cred_username").value = username;
|
|
document.getElementById("password_edit").value = "";
|
|
document.getElementById("password_confirm_edit").value = "";
|
|
PoeUI.openModal("editCredentialModal");
|
|
}
|
|
|
|
function validateCredentialForm(form, id) {
|
|
const pass = document.getElementById("password_" + id);
|
|
const confirm = document.getElementById("password_confirm_" + id);
|
|
if (!pass || !confirm) return true;
|
|
if (pass.value || confirm.value || id === "add") {
|
|
if (pass.value !== confirm.value) {
|
|
confirm.classList.add("is-invalid");
|
|
return false;
|
|
}
|
|
}
|
|
confirm.classList.remove("is-invalid");
|
|
return true;
|
|
}
|
|
</script>
|
|
{% endblock %}
|