Setup-pagina verschijnt niet meer als de setup-status niet te lezen is
De route-guard las elke fout (429, 500, 503, 404) als 'niet geinitialiseerd' en stuurde naar de setup-pagina. Nu geen gok: bij een onleesbare status geen doorverwijzing. De statuslezing valt onder de ruimere limiter in plaats van de strikte login-limiter (die 5 per minuut deelt met echte inlogpogingen). De loginpagina meldt als het CMS uitgeschakeld of in onderhoud is. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import { useAuth } from '@/features/auth/context/auth-context';
|
||||
import { NetworkError, ProblemDetailsError } from '@/lib/api-client';
|
||||
import { loginFormSchema, type LoginFormData } from '@/features/auth/schemas/auth';
|
||||
import { useSystemCapabilities } from '@/features/system/services/useSystemCapabilities';
|
||||
import { useAvailabilityStatus } from '@/features/availability/services/useAvailability';
|
||||
import { Link } from '@tanstack/react-router';
|
||||
|
||||
export function LoginPage() {
|
||||
@@ -20,6 +21,8 @@ export function LoginPage() {
|
||||
const search = useSearch({ strict: false }) as { redirect?: string };
|
||||
const [serverError, setServerError] = useState<string | null>(null);
|
||||
const { data: capabilities } = useSystemCapabilities();
|
||||
const { data: availability } = useAvailabilityStatus();
|
||||
const cmsOff = availability !== undefined && availability.status !== 'Available';
|
||||
|
||||
const {
|
||||
register,
|
||||
@@ -55,6 +58,19 @@ export function LoginPage() {
|
||||
<CardDescription>{t('login.subtitle')}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{cmsOff && (
|
||||
<div
|
||||
role="status"
|
||||
data-testid="login-cms-off"
|
||||
className="mb-4 rounded-md border border-amber-400/50 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:bg-amber-950 dark:text-amber-200"
|
||||
>
|
||||
<p className="font-medium">
|
||||
{availability.status === 'Maintenance' ? t('login.cmsMaintenance') : t('login.cmsDisabled')}
|
||||
</p>
|
||||
{availability.message ? <p>{availability.message}</p> : null}
|
||||
<p>{t('login.cmsOffAdminsOnly')}</p>
|
||||
</div>
|
||||
)}
|
||||
<form onSubmit={onSubmit} noValidate className="space-y-4">
|
||||
{serverError !== null && (
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user