/* * SPDX-FileCopyrightText: 2026 Coffey Labs * * SPDX-License-Identifier: AGPL-3.0-only */ /** * INBUXA: the parts the server's switch (Settings › Security › Hardening) and * a tenant's switch (each tenant's page) share: the impact panel (LP-15), the * statement (LP-16) and the typed confirmation (LP-17). */ import { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Loader2 } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { ago, CONFIRM_PHRASE, describeListener, impactEntries, phraseMatches, type PolicyListener, type RecentUse, } from './protocolPolicy'; /** * The typed confirmation to turn legacy protocols off (LP-17): the button * stays disabled until the phrase matches exactly. */ export function ConfirmTurnOff({ busy, onConfirm, onCancel, }: { busy: boolean; onConfirm: () => void; onCancel: () => void; }) { const { t } = useTranslation(); const [typed, setTyped] = useState(''); return (
); } /** * The impact panel (LP-15): who would notice, shown before anything can * change. With nobody, it says so in one line. */ export function ImpactPanel({ recent }: { recent: RecentUse[] }) { const { t, i18n } = useTranslation(); const entries = impactEntries(recent); // Read once, when the panel appears: "2 days ago" needn't tick. const [now] = useState(() => Date.now()); if (entries.length === 0) { return ({t('legacyProtocols.impactNone', 'No account used a legacy mail app in the last 30 days.')}
); } return ({t('legacyProtocols.impactCount', { count: entries.length, defaultValue_one: '1 account used a legacy mail app in the last 30 days.', defaultValue_other: '{{count}} accounts used a legacy mail app in the last 30 days.', })} {' '} {t('legacyProtocols.impactLead', 'Their mail apps will stop working the moment you turn this on:')}
{t('legacyProtocols.statementTitle', 'Only inbuxa webmail and JMAP apps will work.')}
{scope.kind === 'server' ? t( 'legacyProtocols.statementLead', 'Legacy mail protocols (IMAP, POP3, ManageSieve and sending from mail apps) will be turned off for everyone on this server.', ) : t( 'legacyProtocols.statementLeadTenant', 'Legacy mail protocols (IMAP, POP3, ManageSieve and sending from mail apps) will be turned off for everyone in {{organization}}.', { organization: scope.organization }, )}
{scope.listeners.length > 0 ? t('legacyProtocols.statementPorts', 'The IMAP, POP3 and ManageSieve ports will close: {{list}}.', { list: scope.listeners.map(describeListener).join(', '), }) : t( 'legacyProtocols.statementNoPorts', 'No IMAP, POP3 or ManageSieve listeners are configured, so no ports will close.', )}
)}{t( 'legacyProtocols.statementSubmission', 'Sending from mail apps (SMTP submission) will stop working, but its ports stay open: mail apps will be told they cannot sign in. Incoming mail (SMTP) and inbuxa webmail (JMAP) are not affected and cannot be turned off here.', )}
{scope.kind === 'server' && ({t('legacyProtocols.firewallLead', 'This does not change your firewall or port forwarding.')}{' '} {t( 'legacyProtocols.firewallBody', 'inbuxa stops answering on these ports; anything that still routes them to this server — firewall rules, NAT port-forwards, a load balancer or proxy — is yours to reconcile.', )}
)}{t('legacyProtocols.statementUndo', 'You can turn legacy protocols back on at any time.')}