Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Allow custom error message when logging in #3024

Closed
hiephm opened this issue Jan 18, 2016 · 1 comment
Closed

Improvement: Allow custom error message when logging in #3024

hiephm opened this issue Jan 18, 2016 · 1 comment

Comments

@hiephm
Copy link

hiephm commented Jan 18, 2016

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);
@piotrekkaminski
Copy link
Contributor

Thank you for your submission.

We recently made some changes to the way we process GitHub submissions to more quickly identify and respond to core code issues.

Feature Requests and Improvements should now be submitted to the new Magento 2 Feature Requests and Improvements forum (see details here).

We are closing this GitHub ticket and have moved your request to the new forum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants