diff --git a/app/api/auth/[...nextauth]/options.js b/app/api/auth/[...nextauth]/options.js index 749393a..1352d41 100644 --- a/app/api/auth/[...nextauth]/options.js +++ b/app/api/auth/[...nextauth]/options.js @@ -22,10 +22,6 @@ export const options = { const user = await res.json() - if (!res.ok && user) { - throw new Error('E-mail ou mot de passe incorrect') - } - if (res.ok && user) { return user } diff --git a/app/login/form.js b/app/login/form.js index ceb9a2a..6d9cd9a 100644 --- a/app/login/form.js +++ b/app/login/form.js @@ -19,7 +19,9 @@ export default function LoginForm() { }) if (response?.error) { - if (response.error === 'Configuration') { + if (response.error === 'CredentialsSignin') { + setError('E-mail ou mot de passe incorrect') + } else if (response.error === 'Configuration') { setError('Une erreur s’est produite, contactez l’administrateur !') } else { setError(response.error)