Skip to content

Commit b1fbd95

Browse files
authored
Merge pull request #198 from /issues/188
security-package/issues/188: Added Notice message to system.xml.
2 parents 0092b51 + 6fe6899 commit b1fbd95

File tree

5 files changed

+55
-2
lines changed

5 files changed

+55
-2
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"require": {
55
"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+
}

ReCaptchaUser/etc/adminhtml/system.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
<system>
1111
<section id="recaptcha_backend">
1212
<group id="type_for">
13-
<field id="user_login" translate="label" type="select" sortOrder="100" showInDefault="1"
13+
<field id="user_login" translate="label" type="select" sortOrder="110" showInDefault="1"
1414
showInWebsite="0" showInStore="0" canRestore="1">
1515
<label>Enable for Login</label>
1616
<source_model>Magento\ReCaptchaAdminUi\Model\OptionSource\Type</source_model>
1717
</field>
1818

19-
<field id="user_forgot_password" translate="label" type="select" sortOrder="110" showInDefault="1"
19+
<field id="user_forgot_password" translate="label" type="select" sortOrder="120" showInDefault="1"
2020
showInWebsite="0" showInStore="0" canRestore="1">
2121
<label>Enable for Forgot Password</label>
2222
<source_model>Magento\ReCaptchaAdminUi\Model\OptionSource\Type</source_model>

0 commit comments

Comments
 (0)