Hi team,
I'm working on Metronic Laravel 8.2.3 for my frontend.
Btw, when I login FE never display "Sorry, the email or password is incorrect, please try again."
It only displays:
- "You have successfully logged in!"
- "Sorry, looks like there are some errors detected, please try again."
I do search and found out in "public/assets/js/custom/authentication/sign-in/general.js"
you handle case "Sorry, the email or password is incorrect, please try again." in branch else of if (response)
if (response)
"You have successfully logged in!"
else
"Sorry, the email or password is incorrect, please try again."
I think we could never go to else branch.
Please advise.
Hi,
Sorry for the delay. It seems there might be an issue with the handling of error responses in the login process. You can update the code in the catch block as follows:
.catch(function (error) {
if (error.response.status !== 200) {
Swal.fire({
text: "Sorry, the email or password is incorrect, please try again.",
icon: "error",
buttonsStyling: false,
confirmButtonText: "Ok, got it!",
customClass: {
confirmButton: "btn btn-primary"
}
});
} else {
Swal.fire({
text: "An error occurred. Please try again later.",
icon: "error",
buttonsStyling: false,
confirmButtonText: "Ok, got it!",
customClass: {
confirmButton: "btn btn-primary"
}
});
}
});