import React, { ChangeEvent } from 'react' import { Lock, KeyRound, CheckCircle2, AlertTriangle, Eye, EyeOff } from 'lucide-react' import { useTranslation } from '../i18n' import { useResetPassword } from './resetPassword/useResetPassword' const inputBase: React.CSSProperties = { width: '100%', padding: '11px 44px 11px 38px', borderRadius: 12, border: '1px solid #e5e7eb', fontSize: 14, fontFamily: 'inherit', outline: 'none', transition: 'border-color 120ms', background: 'white', color: '#111827', } const ResetPasswordPage: React.FC = () => { const { t } = useTranslation() // Page = wiring container: token, form state, validation + submit live in the hook. const { navigate, token, pw, setPw, pw2, setPw2, showPw, setShowPw, mfaCode, setMfaCode, mfaRequired, error, success, isLoading, handleSubmit, } = useResetPassword() const shell = (inner: React.ReactNode) => (
{inner}
) if (success) { return shell(

{t('login.resetPasswordSuccessTitle')}

{t('login.resetPasswordSuccessBody')}

) } if (!token) { return shell(

{t('login.resetPasswordInvalidLink')}

{t('login.resetPasswordInvalidLinkBody')}

) } return shell( <>

{t('login.resetPasswordTitle')}

{mfaRequired ? t('login.resetPasswordMfaBody') : t('login.resetPasswordBody')}

{error && (
{error}
)}
{!mfaRequired && ( <>
) => setPw(e.target.value)} required placeholder="••••••••" style={inputBase} onFocus={(e) => { e.currentTarget.style.borderColor = '#111827' }} onBlur={(e) => { e.currentTarget.style.borderColor = '#e5e7eb' }} />
) => setPw2(e.target.value)} required placeholder="••••••••" style={inputBase} onFocus={(e) => { e.currentTarget.style.borderColor = '#111827' }} onBlur={(e) => { e.currentTarget.style.borderColor = '#e5e7eb' }} />
)} {mfaRequired && (
) => setMfaCode(e.target.value)} required placeholder="123456 or backup-code" style={{ ...inputBase, paddingRight: 12 }} autoFocus onFocus={(e) => { e.currentTarget.style.borderColor = '#111827' }} onBlur={(e) => { e.currentTarget.style.borderColor = '#e5e7eb' }} />
)}
) } export default ResetPasswordPage