feat: Add user deletion capability for admins, add WhiteNoise for Django admin static assets, and configure CSRF_TRUSTED_ORIGINS for production reverse proxies

This commit is contained in:
Richard
2026-07-31 11:22:25 +02:00
parent 5f2061f013
commit 2403f1313f
165 changed files with 34871 additions and 40 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -12,7 +12,7 @@
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/gh/arooshbd2024/aCAPTCHA@main/api/captcha-v1.1.js" defer></script>
<title>Schichtplaner — Veranstaltungsschichtpläne</title>
<script type="module" crossorigin src="/assets/index-BVGqcHIp.js"></script>
<script type="module" crossorigin src="/assets/index-DKRQSjit.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-jfrwfPo3.css">
</head>
<body class="bg-paper text-main font-sans antialiased min-h-screen">
+23
View File
@@ -157,6 +157,22 @@ export default function AdminPage({ branding, onRefreshBranding, onRefreshEvents
}
};
const handleDeleteUser = async (userObj) => {
if (!window.confirm(`Möchtest du das Benutzerkonto "${userObj.display_name || userObj.username}" (@${userObj.username}) wirklich dauerhaft löschen?`)) {
return;
}
try {
await apiFetch(`/users/manage-users/${userObj.id}/`, {
method: 'DELETE'
});
setUsersList(usersList.filter(u => u.id !== userObj.id));
showNotif(`Benutzerkonto ${userObj.username} wurde gelöscht.`);
} catch (e) {
setError(e.message || 'Fehler beim Löschen des Benutzers.');
}
};
const handleApprovePendingUser = async (userId) => {
try {
await apiFetch(`/users/${userId}/approve/`, { method: 'POST' });
@@ -549,6 +565,13 @@ export default function AdminPage({ branding, onRefreshBranding, onRefreshEvents
>
{u.is_admin_user ? 'Admin entziehen' : 'Zu Admin machen'}
</button>
<button
onClick={() => handleDeleteUser(u)}
className="px-2 py-1 rounded-sm text-[10px] bg-red-500/10 hover:bg-red-500/20 border border-red-500/20 text-red-400 font-bold transition inline-flex items-center gap-1"
title="Benutzerkonto dauerhaft löschen"
>
<Trash2 className="w-3 h-3" /> Löschen
</button>
</td>
</tr>
))}