From 91074c44b9280cf85ea580b8e8be8b8291ea8a35 Mon Sep 17 00:00:00 2001 From: mage2pratik Date: Wed, 25 Jul 2018 09:41:22 +0530 Subject: [PATCH] Reduce lengthy code of LoginPost --- .../Customer/Controller/Account/LoginPost.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) 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.'));