|
20 | 20 | use Magento\Framework\Exception\InputException;
|
21 | 21 | use Magento\Framework\Exception\InvalidEmailOrPasswordException;
|
22 | 22 | use Magento\Framework\Exception\State\UserLockedException;
|
| 23 | +use Magento\Framework\Escaper; |
23 | 24 |
|
24 | 25 | /**
|
25 | 26 | * Class EditPost
|
@@ -72,28 +73,34 @@ class EditPost extends \Magento\Customer\Controller\AbstractAccount
|
72 | 73 | */
|
73 | 74 | private $customerMapper;
|
74 | 75 |
|
| 76 | + /** @var Escaper */ |
| 77 | + private $escaper; |
| 78 | + |
75 | 79 | /**
|
76 | 80 | * @param Context $context
|
77 | 81 | * @param Session $customerSession
|
78 | 82 | * @param AccountManagementInterface $customerAccountManagement
|
79 | 83 | * @param CustomerRepositoryInterface $customerRepository
|
80 | 84 | * @param Validator $formKeyValidator
|
81 | 85 | * @param CustomerExtractor $customerExtractor
|
| 86 | + * @param Escaper|null $escaper |
82 | 87 | */
|
83 | 88 | public function __construct(
|
84 | 89 | Context $context,
|
85 | 90 | Session $customerSession,
|
86 | 91 | AccountManagementInterface $customerAccountManagement,
|
87 | 92 | CustomerRepositoryInterface $customerRepository,
|
88 | 93 | Validator $formKeyValidator,
|
89 |
| - CustomerExtractor $customerExtractor |
| 94 | + CustomerExtractor $customerExtractor, |
| 95 | + Escaper $escaper = null |
90 | 96 | ) {
|
91 | 97 | parent::__construct($context);
|
92 | 98 | $this->session = $customerSession;
|
93 | 99 | $this->customerAccountManagement = $customerAccountManagement;
|
94 | 100 | $this->customerRepository = $customerRepository;
|
95 | 101 | $this->formKeyValidator = $formKeyValidator;
|
96 | 102 | $this->customerExtractor = $customerExtractor;
|
| 103 | + $this->escaper = $escaper ?: ObjectManager::getInstance()->get(Escaper::class); |
97 | 104 | }
|
98 | 105 |
|
99 | 106 | /**
|
@@ -175,9 +182,9 @@ public function execute()
|
175 | 182 | $this->messageManager->addError($message);
|
176 | 183 | return $resultRedirect->setPath('customer/account/login');
|
177 | 184 | } catch (InputException $e) {
|
178 |
| - $this->messageManager->addError($e->getMessage()); |
| 185 | + $this->messageManager->addErrorMessage($this->escaper->escapeHtml($e->getMessage())); |
179 | 186 | foreach ($e->getErrors() as $error) {
|
180 |
| - $this->messageManager->addError($error->getMessage()); |
| 187 | + $this->messageManager->addErrorMessage($this->escaper->escapeHtml($error->getMessage())); |
181 | 188 | }
|
182 | 189 | } catch (\Magento\Framework\Exception\LocalizedException $e) {
|
183 | 190 | $this->messageManager->addError($e->getMessage());
|
|
0 commit comments