import { useEffect, useState } from 'react'; import { Link } from 'react-router-dom'; import { AlertTriangle, ShieldAlert } from 'lucide-react'; import { authApi } from '../services/api'; interface SecurityStatus { warnings: string[]; } export default function SecurityBanners() { const [status, setStatus] = useState(null); useEffect(() => { authApi.securityStatus() .then((r) => setStatus(r.data)) .catch(() => {}); }, []); const noWarnings = !status || status.warnings.length === 0; if (noWarnings) return null; const hasSecretsNotPersisted = !!status && status.warnings.includes('secrets_not_persisted'); const hasAdminWarning = !!status && status.warnings.includes('admin_password_default'); return (
{hasSecretsNotPersisted && (
Security warning:{' '} Auto-generated secrets could not be saved, so they will change on every restart — logging users out and potentially orphaning stored device credentials. Mount a writable volume at{' '} SECRETS_DIR (default{' '} /app/data) or set{' '} JWT_SECRET and{' '} ENCRYPTION_KEY in your{' '} .env.
)} {hasAdminWarning && (
Critical: The{' '} admin account is using the default password. Change it immediately.
Change password
)}
); }