Skip to content

Commit 0f3e34d

Browse files
author
Stanislav Idolov
authored
ENGCOM-2519: [Forwardport] Reduce lengthy code of LoginPost #17107
2 parents b6e27ca + b6c647b commit 0f3e34d

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

app/code/Magento/Customer/Controller/Account/LoginPost.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,31 +202,28 @@ public function execute()
202202
'This account is not confirmed. <a href="%1">Click here</a> to resend confirmation email.',
203203
$value
204204
);
205-
$this->messageManager->addError($message);
206-
$this->session->setUsername($login['username']);
207205
} catch (UserLockedException $e) {
208206
$message = __(
209207
'The account sign-in was incorrect or your account is disabled temporarily. '
210208
. 'Please wait and try again later.'
211209
);
212-
$this->messageManager->addError($message);
213-
$this->session->setUsername($login['username']);
214210
} catch (AuthenticationException $e) {
215211
$message = __(
216212
'The account sign-in was incorrect or your account is disabled temporarily. '
217213
. 'Please wait and try again later.'
218214
);
219-
$this->messageManager->addError($message);
220-
$this->session->setUsername($login['username']);
221215
} catch (LocalizedException $e) {
222216
$message = $e->getMessage();
223-
$this->messageManager->addError($message);
224-
$this->session->setUsername($login['username']);
225217
} catch (\Exception $e) {
226218
// PA DSS violation: throwing or logging an exception here can disclose customer password
227219
$this->messageManager->addError(
228220
__('An unspecified error occurred. Please contact us for assistance.')
229221
);
222+
} finally {
223+
if (isset($message)) {
224+
$this->messageManager->addError($message);
225+
$this->session->setUsername($login['username']);
226+
}
230227
}
231228
} else {
232229
$this->messageManager->addError(__('A login and a password are required.'));

0 commit comments

Comments
 (0)