Skip to content

Commit 420b73c

Browse files
authored
Merge pull request #233 from magento/1.0.0-develop
Merge 1.0.0 develop into 1.0-develop
2 parents 0a66936 + b1fbd95 commit 420b73c

File tree

40 files changed

+226
-200
lines changed

40 files changed

+226
-200
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\ReCaptchaAdminUi\Block\Adminhtml\System\Config\Form\Field;
9+
10+
use Magento\Config\Block\System\Config\Form\Field;
11+
use Magento\Framework\Data\Form\Element\AbstractElement;
12+
13+
/**
14+
* Class for Notice
15+
*/
16+
class Notice extends Field
17+
{
18+
19+
/**
20+
* Render text
21+
*
22+
* @param AbstractElement $element
23+
*
24+
* @return string
25+
*/
26+
public function render(AbstractElement $element)
27+
{
28+
$html = '<td colspan="4"><p class="' . $element->getId() . '_notice">' . '<strong>' . __('Important:')
29+
. ' ' . '</strong>' . ' <span>' . __('Please note, for reCAPTCHA to be enabled,
30+
the valid "Google API Website Key" and "Google API Secret Key" fields are required.') . '</span>' . '</p></td>';
31+
32+
return $this->_decorateRowHtml($element, $html);
33+
}
34+
}

ReCaptchaAdminUi/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
"name": "magento/module-re-captcha-admin-ui",
33
"description": "Google reCAPTCHA integration for Magento2",
44
"require": {
5-
"php": "~7.1.3||~7.2.0||~7.3.0",
5+
"php": "~7.3.0||~7.4.0",
66
"magento/framework": "*",
7+
"magento/module-config": "*",
78
"magento/module-re-captcha-ui": "*"
89
},
910
"type": "magento2-module",

ReCaptchaAdminUi/etc/adminhtml/system.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
<group id="type_for" translate="label" type="text" sortOrder="1000" showInDefault="1" showInWebsite="0"
2323
showInStore="0">
2424
<label>Admin Panel</label>
25+
<field id="recaptcha_backend_info_heading" translate="label" sortOrder="100" showInDefault="1"
26+
showInWebsite="0" showInStore="0" >
27+
<frontend_model>Magento\ReCaptchaAdminUi\Block\Adminhtml\System\Config\Form\Field\Notice</frontend_model>
28+
</field>
2529
</group>
2630
</section>
2731

@@ -35,6 +39,10 @@
3539
<group id="type_for" translate="label" type="text" sortOrder="1000" showInDefault="1" showInWebsite="1"
3640
showInStore="0">
3741
<label>Storefront</label>
42+
<field id="recaptcha_frontend_info_heading" translate="label" sortOrder="100" showInDefault="1"
43+
showInWebsite="1" showInStore="0">
44+
<frontend_model>Magento\ReCaptchaAdminUi\Block\Adminhtml\System\Config\Form\Field\Notice</frontend_model>
45+
</field>
3846
</group>
3947
</section>
4048
</system>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
.recaptcha_backend_type_for_recaptcha_backend_info_heading_notice,
6+
.recaptcha_frontend_type_for_recaptcha_frontend_info_heading_notice {
7+
strong {
8+
color: @grid-severity-critical-color;
9+
}
10+
}

ReCaptchaCheckout/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-re-captcha-checkout",
33
"description": "Google reCAPTCHA integration for Magento2",
44
"require": {
5-
"php": "~7.1.3||~7.2.0||~7.3.0",
5+
"php": "~7.3.0||~7.4.0",
66
"magento/framework": "*",
77
"magento/module-checkout": "*",
88
"magento/module-re-captcha-ui": "*"

ReCaptchaContact/Test/Integration/ContactFormTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ private function checkSuccessfulGetResponse($shouldContainReCaptcha = false): vo
178178
self::assertNotEmpty($content);
179179

180180
$shouldContainReCaptcha
181-
? self::assertContains('field-recaptcha', $content)
182-
: self::assertNotContains('field-recaptcha', $content);
181+
? self::assertStringContainsString('field-recaptcha', $content)
182+
: self::assertStringNotContainsString('field-recaptcha', $content);
183183

184184
self::assertEmpty($this->getSessionMessages(MessageInterface::TYPE_ERROR));
185185
}
@@ -193,7 +193,7 @@ private function checkSuccessfulPostResponse(array $postValues = []): void
193193
$this->makePostRequest($postValues);
194194

195195
$this->assertSessionMessages(
196-
self::contains(
196+
self::containsEqual(
197197
"Thanks for contacting us with your comments and questions. We&#039;ll respond to you very soon."
198198
),
199199
MessageInterface::TYPE_SUCCESS

ReCaptchaContact/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/module-re-captcha-contact",
33
"description": "Google reCAPTCHA integration for Magento2",
44
"require": {
5-
"php": "~7.1.3||~7.2.0||~7.3.0",
5+
"php": "~7.3.0||~7.4.0",
66
"magento/framework": "*",
77
"magento/module-re-captcha-ui": "*"
88
},

ReCaptchaCustomer/Test/Integration/AjaxLoginFormTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Magento\TestFramework\App\MutableScopeConfig;
1919
use Magento\TestFramework\TestCase\AbstractController;
2020
use PHPUnit\Framework\MockObject\MockObject;
21-
use Zend\Http\Headers;
21+
use Laminas\Http\Headers;
2222

2323
/**
2424
* @magentoDataFixture Magento/Customer/_files/customer.php
@@ -188,8 +188,8 @@ private function checkSuccessfulGetResponse($shouldContainReCaptcha = false): vo
188188
self::assertNotEmpty($content);
189189

190190
$shouldContainReCaptcha
191-
? $this->assertContains('recaptcha-popup-login', $content)
192-
: $this->assertNotContains('recaptcha-popup-login', $content);
191+
? $this->assertStringContainsString('recaptcha-popup-login', $content)
192+
: $this->assertStringNotContainsString('recaptcha-popup-login', $content);
193193

194194
self::assertEmpty($this->getSessionMessages(MessageInterface::TYPE_ERROR));
195195
}

ReCaptchaCustomer/Test/Integration/CreateCustomerFormTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
/**
2626
* @magentoAppArea frontend
2727
* @magentoAppIsolation enabled
28+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2829
*/
2930
class CreateCustomerFormTest extends AbstractController
3031
{
@@ -201,8 +202,8 @@ private function checkSuccessfulGetResponse($shouldContainReCaptcha = false): vo
201202
self::assertNotEmpty($content);
202203

203204
$shouldContainReCaptcha
204-
? $this->assertContains('field-recaptcha', $content)
205-
: $this->assertNotContains('field-recaptcha', $content);
205+
? $this->assertStringContainsString('field-recaptcha', $content)
206+
: $this->assertStringNotContainsString('field-recaptcha', $content);
206207

207208
self::assertEmpty($this->getSessionMessages(MessageInterface::TYPE_ERROR));
208209
}

ReCaptchaCustomer/Test/Integration/ForgotPasswordFormTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ private function checkSuccessfulGetResponse($shouldContainReCaptcha = false): vo
195195
self::assertNotEmpty($content);
196196

197197
$shouldContainReCaptcha
198-
? $this->assertContains('field-recaptcha', $content)
199-
: $this->assertNotContains('field-recaptcha', $content);
198+
? $this->assertStringContainsString('field-recaptcha', $content)
199+
: $this->assertStringNotContainsString('field-recaptcha', $content);
200200

201201
self::assertEmpty($this->getSessionMessages(MessageInterface::TYPE_ERROR));
202202
}

0 commit comments

Comments
 (0)