diff --git a/app/code/Magento/Customer/Controller/Account/LoginPost.php b/app/code/Magento/Customer/Controller/Account/LoginPost.php index 49a3f95379d4b..5c7eee78e5f4a 100644 --- a/app/code/Magento/Customer/Controller/Account/LoginPost.php +++ b/app/code/Magento/Customer/Controller/Account/LoginPost.php @@ -202,31 +202,28 @@ public function execute() 'This account is not confirmed. Click here to resend confirmation email.', $value ); - $this->messageManager->addError($message); - $this->session->setUsername($login['username']); } catch (UserLockedException $e) { $message = __( 'The account sign-in was incorrect or your account is disabled temporarily. ' . 'Please wait and try again later.' ); - $this->messageManager->addError($message); - $this->session->setUsername($login['username']); } catch (AuthenticationException $e) { $message = __( 'The account sign-in was incorrect or your account is disabled temporarily. ' . 'Please wait and try again later.' ); - $this->messageManager->addError($message); - $this->session->setUsername($login['username']); } catch (LocalizedException $e) { $message = $e->getMessage(); - $this->messageManager->addError($message); - $this->session->setUsername($login['username']); } catch (\Exception $e) { // PA DSS violation: throwing or logging an exception here can disclose customer password $this->messageManager->addError( __('An unspecified error occurred. Please contact us for assistance.') ); + } finally { + if (isset($message)) { + $this->messageManager->addError($message); + $this->session->setUsername($login['username']); + } } } else { $this->messageManager->addError(__('A login and a password are required.'));