Skip to content

Commit c3e4583

Browse files
author
Bohdan Korablov
committed
MAGETWO-51898: [Github] Incorrect CAPTCHA by user loses form entries. #4138
1 parent 18aefd8 commit c3e4583

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

app/code/Magento/Captcha/Observer/CheckContactUsFormObserver.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class CheckContactUsFormObserver implements ObserverInterface
3939
/**
4040
* @var DataPersistorInterface
4141
*/
42-
protected $dataPersistor;
42+
private $dataPersistor;
4343

4444
/**
4545
* @param \Magento\Captcha\Helper\Data $helper
@@ -95,6 +95,7 @@ private function getDataPersistor()
9595
$this->dataPersistor = ObjectManager::getInstance()
9696
->get(DataPersistorInterface::class);
9797
}
98+
9899
return $this->dataPersistor;
99100
}
100101
}

app/code/Magento/Contact/Controller/Index/Post.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Post extends \Magento\Contact\Controller\Index
1414
/**
1515
* @var DataPersistorInterface
1616
*/
17-
protected $dataPersistor;
17+
private $dataPersistor;
1818

1919
/**
2020
* Post user question
@@ -98,6 +98,7 @@ private function getDataPersistor()
9898
$this->dataPersistor = ObjectManager::getInstance()
9999
->get(DataPersistorInterface::class);
100100
}
101+
101102
return $this->dataPersistor;
102103
}
103104
}

app/code/Magento/Contact/Helper/Data.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper
3333
/**
3434
* @var DataPersistorInterface
3535
*/
36-
protected $dataPersistor;
36+
private $dataPersistor;
3737

3838
/**
3939
* @var array
4040
*/
41-
protected $postData = [];
41+
private $postData = null;
4242

4343
/**
4444
* @param \Magento\Framework\App\Helper\Context $context
@@ -82,6 +82,7 @@ public function getUserName()
8282
* @var \Magento\Customer\Api\Data\CustomerInterface $customer
8383
*/
8484
$customer = $this->_customerSession->getCustomerDataObject();
85+
8586
return trim($this->_customerViewHelper->getCustomerName($customer));
8687
}
8788

@@ -99,6 +100,7 @@ public function getUserEmail()
99100
* @var CustomerInterface $customer
100101
*/
101102
$customer = $this->_customerSession->getCustomerDataObject();
103+
102104
return $customer->getEmail();
103105
}
104106

@@ -110,7 +112,7 @@ public function getUserEmail()
110112
*/
111113
public function getPostValue($key)
112114
{
113-
if (!$this->postData) {
115+
if (null === $this->postData) {
114116
$this->postData = (array) $this->getDataPersistor()->get('contact_us');
115117
$this->getDataPersistor()->clear('contact_us');
116118
}
@@ -133,6 +135,7 @@ private function getDataPersistor()
133135
$this->dataPersistor = ObjectManager::getInstance()
134136
->get(DataPersistorInterface::class);
135137
}
138+
136139
return $this->dataPersistor;
137140
}
138141
}

0 commit comments

Comments
 (0)