diff --git a/apps/edr-passenger-web/backoffice/src/app/login/page.tsx b/apps/edr-passenger-web/backoffice/src/app/login/page.tsx index 4f0098792..899e8cd11 100644 --- a/apps/edr-passenger-web/backoffice/src/app/login/page.tsx +++ b/apps/edr-passenger-web/backoffice/src/app/login/page.tsx @@ -20,13 +20,15 @@ const features = [ ]; export default function LoginPage() { - const [email, setEmail] = useState(''); + // Accepts an email address, phone number, or username — sent to the IAM in + // the `email` field either way (the backend contract does not change). + const [identifier, setIdentifier] = useState(''); const [password, setPassword] = useState(''); const [loading, setLoading] = useState(false); const [error, setError] = useState(''); const [showPassword, setShowPassword] = useState(false); const [isMounted, setIsMounted] = useState(false); - const [emailFocused, setEmailFocused] = useState(false); + const [identifierFocused, setIdentifierFocused] = useState(false); const [passwordFocused, setPasswordFocused] = useState(false); const [view, setView] = useState<'login' | 'forgot'>('login'); @@ -47,7 +49,7 @@ export default function LoginPage() { setLoading(true); setError(''); try { - await login(email, password); + await login(identifier.trim(), password); router.push('/dashboard'); } catch (err: any) { const msg = err.message || err.response?.data?.message || ''; @@ -152,26 +154,29 @@ export default function LoginPage() {
- {/* Email field */} + {/* Identifier field — email, phone number, or username */}
{ setEmail(e.target.value); setError(''); }} - onFocus={() => setEmailFocused(true)} - onBlur={() => setEmailFocused(false)} + type="text" + value={identifier} + onChange={(e) => { setIdentifier(e.target.value); setError(''); }} + onFocus={() => setIdentifierFocused(true)} + onBlur={() => setIdentifierFocused(false)} className="w-full px-4 py-3 rounded-xl bg-white dark:bg-gray-900 text-gray-900 dark:text-white placeholder:text-gray-400 dark:placeholder:text-gray-600 text-sm focus:outline-none" - placeholder="name@edr.com" + placeholder="name@edr.com, +251… or username" required - autoComplete="email" + autoCapitalize="none" + autoCorrect="off" + spellCheck={false} + autoComplete="username" />
@@ -209,7 +214,7 @@ export default function LoginPage() {