isAuthenticated()) { $currentUser = is_array($_SESSION['desktop_auth']['user'] ?? null) ? $_SESSION['desktop_auth']['user'] : []; $accountCheck = $accountGate->checkUsername((string) ($currentUser['username'] ?? '')); if (!($accountCheck['allowed'] ?? false)) { $auth->logout(); $target = (string) ($accountCheck['state'] ?? '') === 'pending' ? '/auth/pending/?username=' . urlencode((string) ($currentUser['username'] ?? '')) : '/auth/inactive/?message=' . urlencode((string) ($accountCheck['message'] ?? 'Dieses Konto ist noch nicht freigeschaltet.')); header('Location: ' . $target, true, 302); exit; } } if (!$auth->shouldShowDesktop()) { if ($auth->isConfigured()) { header('Location: /auth/keycloak', true, 302); exit; } http_response_code(503); echo 'Keycloak ist nicht konfiguriert.'; exit; } $app = new App($projectRoot); $desktopPayload = $app->desktopPayload(); require $projectRoot . '/partials/desktop/shell.php';