🎉 Improved Backend Structure & Documentation 🎉

This commit is contained in:
2025-06-01 12:42:47 +02:00
parent 3501bbfddf
commit 7f7006d55c
64 changed files with 3222 additions and 2328 deletions

View File

@ -780,53 +780,32 @@
<script>
/**
* Logout-Handler für sicheres Abmelden
* Unterstützt sowohl das moderne Glassmorphism-System als auch Fallback-Bestätigung
*/
function handleLogout() {
// Verwende das moderne Glassmorphism-Bestätigungssystem
if (typeof showConfirmationToast === 'function') {
showConfirmationToast(
'Möchten Sie sich wirklich abmelden?',
() => {
// Loading-Animation anzeigen
document.body.style.opacity = '0.7';
document.body.style.pointerEvents = 'none';
// CSRF-Token aus Meta-Tag holen
const csrfToken = document.querySelector('meta[name="csrf-token"]');
// Logout-Formular erstellen und absenden
const form = document.createElement('form');
form.method = 'POST';
form.action = '{{ url_for("auth_logout") }}';
form.style.display = 'none';
// CSRF-Token hinzufügen falls verfügbar
if (csrfToken) {
const input = document.createElement('input');
input.type = 'hidden';
input.name = 'csrf_token';
input.value = csrfToken.getAttribute('content');
form.appendChild(input);
}
// Formular absenden
document.body.appendChild(form);
form.submit();
},
null,
{
title: 'Abmeldung bestätigen',
confirmText: 'Abmelden',
cancelText: 'Abbrechen'
}
);
} else {
// Fallback für den Fall, dass das Glassmorphism-System nicht verfügbar ist
if (confirm('Möchten Sie sich wirklich abmelden?')) {
console.log('🚪 Abmeldung angefordert');
// Funktion für die tatsächliche Abmeldung
function performLogout() {
try {
console.log('🔄 Abmeldung wird durchgeführt...');
// Loading-Animation anzeigen
document.body.style.opacity = '0.7';
document.body.style.pointerEvents = 'none';
// Status-Feedback anzeigen
const loadingMessage = document.createElement('div');
loadingMessage.id = 'logout-loading';
loadingMessage.style.cssText = `
position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
background: rgba(0, 0, 0, 0.8); color: white; padding: 20px 40px;
border-radius: 8px; z-index: 9999; font-family: sans-serif;
backdrop-filter: blur(10px);
`;
loadingMessage.textContent = 'Abmeldung wird durchgeführt...';
document.body.appendChild(loadingMessage);
// CSRF-Token aus Meta-Tag holen
const csrfToken = document.querySelector('meta[name="csrf-token"]');
@ -848,6 +827,54 @@
// Formular absenden
document.body.appendChild(form);
form.submit();
} catch (error) {
console.error('❌ Fehler bei der Abmeldung:', error);
// Bei Fehler direkt zur Login-Seite weiterleiten
window.location.href = '/auth/login';
}
}
// Abbruch-Funktion
function cancelLogout() {
console.log('❌ Abmeldung abgebrochen');
// Nichts zu tun - Toast wird automatisch geschlossen
}
// Prüfen ob das moderne Glassmorphism-System verfügbar ist
if (typeof showConfirmationToast === 'function' && window.glassNotificationSystem) {
console.log('✨ Verwende modernes Glassmorphism-Bestätigungssystem');
try {
showConfirmationToast(
'Möchten Sie sich wirklich abmelden?',
performLogout,
cancelLogout,
{
title: 'Abmeldung bestätigen',
confirmText: 'Abmelden',
cancelText: 'Abbrechen'
}
);
} catch (error) {
console.warn('⚠️ Glassmorphism-System Fehler, verwende Fallback:', error);
// Bei Fehler mit Glassmorphism-System zum Standard-Fallback wechseln
useStandardConfirmation();
}
} else {
console.log('📋 Verwende Standard-Bestätigungsdialog');
useStandardConfirmation();
}
// Standard-Bestätigungslogik
function useStandardConfirmation() {
// Verbesserte Standard-Bestätigung mit besserer UX
const confirmation = confirm('Möchten Sie sich wirklich abmelden?\n\nSie werden zur Anmeldeseite weitergeleitet.');
if (confirmation) {
performLogout();
} else {
console.log('❌ Abmeldung abgebrochen (Standard-Dialog)');
}
}
}