Skip to content

Commit e4d9000

Browse files
author
Dmytro Voskoboinikov
committed
Merge branch 'MAGETWO-88005' into 2.2.6-bugfixes-160718
2 parents dba7397 + b8c3218 commit e4d9000

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Magento\Framework\Exception\InputException;
2121
use Magento\Framework\Exception\InvalidEmailOrPasswordException;
2222
use Magento\Framework\Exception\State\UserLockedException;
23+
use Magento\Framework\Escaper;
2324

2425
/**
2526
* Class EditPost
@@ -72,28 +73,34 @@ class EditPost extends \Magento\Customer\Controller\AbstractAccount
7273
*/
7374
private $customerMapper;
7475

76+
/** @var Escaper */
77+
private $escaper;
78+
7579
/**
7680
* @param Context $context
7781
* @param Session $customerSession
7882
* @param AccountManagementInterface $customerAccountManagement
7983
* @param CustomerRepositoryInterface $customerRepository
8084
* @param Validator $formKeyValidator
8185
* @param CustomerExtractor $customerExtractor
86+
* @param Escaper|null $escaper
8287
*/
8388
public function __construct(
8489
Context $context,
8590
Session $customerSession,
8691
AccountManagementInterface $customerAccountManagement,
8792
CustomerRepositoryInterface $customerRepository,
8893
Validator $formKeyValidator,
89-
CustomerExtractor $customerExtractor
94+
CustomerExtractor $customerExtractor,
95+
Escaper $escaper = null
9096
) {
9197
parent::__construct($context);
9298
$this->session = $customerSession;
9399
$this->customerAccountManagement = $customerAccountManagement;
94100
$this->customerRepository = $customerRepository;
95101
$this->formKeyValidator = $formKeyValidator;
96102
$this->customerExtractor = $customerExtractor;
103+
$this->escaper = $escaper ?: ObjectManager::getInstance()->get(Escaper::class);
97104
}
98105

99106
/**
@@ -175,9 +182,9 @@ public function execute()
175182
$this->messageManager->addError($message);
176183
return $resultRedirect->setPath('customer/account/login');
177184
} catch (InputException $e) {
178-
$this->messageManager->addError($e->getMessage());
185+
$this->messageManager->addErrorMessage($this->escaper->escapeHtml($e->getMessage()));
179186
foreach ($e->getErrors() as $error) {
180-
$this->messageManager->addError($error->getMessage());
187+
$this->messageManager->addErrorMessage($this->escaper->escapeHtml($error->getMessage()));
181188
}
182189
} catch (\Magento\Framework\Exception\LocalizedException $e) {
183190
$this->messageManager->addError($e->getMessage());

dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ public function testMissingDataEditPostAction()
596596

597597
$this->assertRedirect($this->stringContains('customer/account/edit/'));
598598
$this->assertSessionMessages(
599-
$this->equalTo(['"Email" is not a valid email address.']),
599+
$this->equalTo(['"Email" is not a valid email address.']),
600600
MessageInterface::TYPE_ERROR
601601
);
602602
}
@@ -655,7 +655,7 @@ public function testWrongConfirmationEditPostAction()
655655

656656
$this->assertRedirect($this->stringContains('customer/account/edit/'));
657657
$this->assertSessionMessages(
658-
$this->equalTo(['Password confirmation doesn\'t match entered password.']),
658+
$this->equalTo(['Password confirmation doesn't match entered password.']),
659659
MessageInterface::TYPE_ERROR
660660
);
661661
}

0 commit comments

Comments
 (0)