-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Description
Although Magento 2 allows hooking to event when logging in to add additional validations (just like Magento 1), there is no way to change the error message if those validation failed (e.g by throwing Exception) since a default message is used for general Exception:
# \Magento\Customer\Controller\Account\LoginPost::execute()
...
} catch (\Exception $e) {
$this->messageManager->addError(__('Invalid login or password.'));
}
In the other hand, the same logic in Magento 1 is more customizable:
# \Mage_Customer_AccountController::loginPostAction()
switch ($e->getCode()) {
...
default:
$message = $e->getMessage();
}
$session->addError($message);