fix: connexion par identifiant (adminItinova) ou email - conformité skill itinova-user-management
This commit is contained in:
@@ -4,7 +4,7 @@ import { useAuth } from '../context/AuthContext';
|
||||
import toast from 'react-hot-toast';
|
||||
|
||||
export default function Login() {
|
||||
const [email, setEmail] = useState('');
|
||||
const [loginValue, setLoginValue] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
const [loading, setLoading] = useState(false);
|
||||
const { login } = useAuth();
|
||||
@@ -14,7 +14,7 @@ export default function Login() {
|
||||
e.preventDefault();
|
||||
setLoading(true);
|
||||
try {
|
||||
await login(email, password);
|
||||
await login(loginValue, password);
|
||||
toast.success('Connexion réussie');
|
||||
navigate('/');
|
||||
} catch (error: any) {
|
||||
@@ -79,18 +79,19 @@ export default function Login() {
|
||||
<div className="bg-white rounded-2xl shadow-lg p-8">
|
||||
<form onSubmit={handleSubmit} className="space-y-5">
|
||||
<div>
|
||||
<label htmlFor="email" className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Adresse email
|
||||
<label htmlFor="login" className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Identifiant ou email
|
||||
</label>
|
||||
<input
|
||||
id="email"
|
||||
type="email"
|
||||
value={email}
|
||||
onChange={(e) => setEmail(e.target.value)}
|
||||
id="login"
|
||||
type="text"
|
||||
value={loginValue}
|
||||
onChange={(e) => setLoginValue(e.target.value)}
|
||||
className="input-field"
|
||||
placeholder="votre@email.com"
|
||||
placeholder="adminItinova ou votre@email.com"
|
||||
required
|
||||
autoFocus
|
||||
autoComplete="username"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user