42 private $dataPersistor;
59 $this->_actionFlag = $actionFlag;
73 $formId =
'contact_us';
74 $captcha = $this->_helper->getCaptcha($formId);
78 if (!
$captcha->isCorrect($this->captchaStringResolver->resolve(
$controller->getRequest(), $formId))) {
79 $this->messageManager->addError(
__(
'Incorrect CAPTCHA.'));
80 $this->getDataPersistor()->set($formId,
$controller->getRequest()->getPostValue());
81 $this->_actionFlag->set(
'', \
Magento\Framework\
App\Action\Action::FLAG_NO_DISPATCH,
true);
82 $this->redirect->redirect(
$controller->getResponse(),
'contact/index/index');
92 private function getDataPersistor()
94 if ($this->dataPersistor ===
null) {
96 ->get(DataPersistorInterface::class);
99 return $this->dataPersistor;
execute(Observer $observer)