dont add in unit tests - so controllers which use the component can be tested easier
This commit is contained in:
@@ -62,7 +62,7 @@ class ContactUsComponent extends Component {
|
||||
* @return \Cake\Datasource\EntityInterface|\CakeContactUs\Model\Entity\ContactUsFormSubmission
|
||||
*/
|
||||
public function newContactUsForm() {
|
||||
if ($this->getConfig('requireCaptcha')) {
|
||||
if ($this->getConfig('requireCaptcha') && PHP_SAPI !== 'cli') {
|
||||
$this->ContactUsFormSubmissions->addBehavior('Captcha.Captcha');
|
||||
}
|
||||
|
||||
@@ -78,8 +78,7 @@ class ContactUsComponent extends Component {
|
||||
if (!isset($postData)) {
|
||||
$postData = $this->getController()->getRequest()->getData();
|
||||
}
|
||||
$postData['client_ip'] = array_key_exists('client_ip', $postData) && $postData['client_ip'] ?
|
||||
$postData['client_ip'] :
|
||||
$postData['client_ip'] = $postData['client_ip'] ??
|
||||
($this->getConfig('clientIpHeader') ?
|
||||
$this->getController()->getRequest()->getHeaderLine($this->getConfig('clientIpHeader')) :
|
||||
$this->getController()->getRequest()->clientIp()
|
||||
@@ -90,7 +89,6 @@ class ContactUsComponent extends Component {
|
||||
'contactUsFormSubmission' => $contactUsFormSubmission,
|
||||
], $this->getController());
|
||||
$result = $event->getResult();
|
||||
|
||||
if ($result instanceof EntityInterface) {
|
||||
$postData = $result->toArray();
|
||||
$contactUsFormSubmission = $this->ContactUsFormSubmissions->patchEntity($contactUsFormSubmission, $postData);
|
||||
|
||||
Reference in New Issue
Block a user