feat: Add email verification, owner shift deletion, Coolify Docker compose setup, and fixes
This commit is contained in:
+26
-2
@@ -106,14 +106,34 @@ export default function App() {
|
||||
try {
|
||||
const userData = await apiFetch('/users/me/');
|
||||
setUser(userData);
|
||||
if (!userData.is_admin_user && !userData.is_staff && !userData.is_superuser && activeTab === 'admin') {
|
||||
setActiveTab('home');
|
||||
}
|
||||
} catch (e) {
|
||||
setAuthToken(null);
|
||||
setUser(null);
|
||||
setActiveTab('home');
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Check URL parameters for guest account claim link
|
||||
// 3. Check URL parameters for email verification and claim link
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const verifyToken = urlParams.get('verify_email');
|
||||
if (verifyToken) {
|
||||
try {
|
||||
const data = await apiFetch('/users/verify-email/', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ token: verifyToken })
|
||||
});
|
||||
setAuthToken(data.token);
|
||||
setUser(data.user);
|
||||
showNotification(data.message || '✅ E-Mail-Adresse erfolgreich bestätigt!');
|
||||
window.history.replaceState({}, document.title, window.location.pathname);
|
||||
} catch (err) {
|
||||
showNotification(`⚠️ E-Mail Bestätigung: ${err.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
const cToken = urlParams.get('claim_token');
|
||||
const gName = urlParams.get('guest_name');
|
||||
if (cToken && gName) {
|
||||
@@ -190,12 +210,16 @@ export default function App() {
|
||||
const handleLogout = () => {
|
||||
setAuthToken(null);
|
||||
setUser(null);
|
||||
setActiveTab('home');
|
||||
showNotification('Erfolgreich abgemeldet.');
|
||||
if (selectedEventId) fetchEventMatrix(selectedEventId);
|
||||
};
|
||||
|
||||
const handleAuthSuccess = (userData, message) => {
|
||||
setUser(userData);
|
||||
if (userData && !userData.is_admin_user && !userData.is_staff && !userData.is_superuser && activeTab === 'admin') {
|
||||
setActiveTab('home');
|
||||
}
|
||||
showNotification(message || 'Erfolgreich angemeldet!');
|
||||
if (selectedEventId) fetchEventMatrix(selectedEventId);
|
||||
};
|
||||
@@ -423,7 +447,7 @@ export default function App() {
|
||||
onSelectEvent={handleSelectEvent}
|
||||
branding={branding}
|
||||
/>
|
||||
) : activeTab === 'admin' ? (
|
||||
) : activeTab === 'admin' && user && (user.is_admin_user || user.is_staff || user.is_superuser) ? (
|
||||
<AdminPage
|
||||
branding={branding}
|
||||
onRefreshBranding={async () => {
|
||||
|
||||
Reference in New Issue
Block a user