├── .gitignore ├── screenshots ├── backend.png ├── config.png ├── frontend.png ├── frontend_register.png ├── invisible_recaptcha.png └── invisible_recaptcha2.png ├── README.md ├── ISSUE_TEMPLATE.md ├── composer.json ├── view ├── adminhtml │ ├── web │ │ └── css │ │ │ └── msp_recaptcha.less │ ├── layout │ │ ├── msp_recaptcha.xml │ │ ├── adminhtml_auth_forgotpassword.xml │ │ └── adminhtml_auth_login.xml │ └── templates │ │ └── msp_recaptcha.phtml └── frontend │ ├── web │ ├── css │ │ └── source │ │ │ └── _module.less │ ├── js │ │ ├── registry.js │ │ ├── ui-messages-mixin.js │ │ └── reCaptcha.js │ └── template │ │ └── reCaptcha.html │ ├── requirejs-config.js │ ├── templates │ └── msp_recaptcha.phtml │ └── layout │ ├── contact_index_index.xml │ ├── customer_account_login.xml │ ├── customer_account_create.xml │ ├── customer_account_forgotpassword.xml │ ├── default.xml │ └── checkout_index_index.xml ├── registration.php ├── Model ├── IsCheckRequiredInterface.php ├── Provider │ ├── ResponseProviderInterface.php │ ├── Failure │ │ ├── RedirectUrlProviderInterface.php │ │ ├── AuthenticationExceptionFailure.php │ │ ├── RedirectUrl │ │ │ ├── BeforeAuthUrlProvider.php │ │ │ └── SimpleUrlProvider.php │ │ ├── AjaxResponseFailure.php │ │ └── ObserverRedirectFailure.php │ ├── FailureProviderInterface.php │ └── Response │ │ ├── DefaultResponseProvider.php │ │ └── AjaxResponseProvider.php ├── Config │ └── Source │ │ ├── Size.php │ │ ├── Theme.php │ │ ├── Position.php │ │ └── Type.php ├── Validate.php ├── LayoutSettings.php ├── IsCheckRequired.php └── Config.php ├── etc ├── module.xml ├── adminhtml │ ├── events.xml │ ├── di.xml │ └── system.xml ├── config.xml ├── acl.xml ├── frontend │ ├── events.xml │ └── di.xml └── di.xml ├── Api └── ValidateInterface.php ├── Plugin ├── ExcludeFromMinification.php └── Block │ └── Account │ └── AuthenticationPopupPlugin.php ├── Block ├── LayoutProcessor │ └── Checkout │ │ └── Onepage.php ├── Adminhtml │ └── ReCaptcha.php └── Frontend │ └── ReCaptcha.php ├── Command └── ReCaptcha.php ├── Observer └── ReCaptchaObserver.php └── Setup └── UpgradeData.php /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | -------------------------------------------------------------------------------- /screenshots/backend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magespecialist/m2-MSP_ReCaptcha/HEAD/screenshots/backend.png -------------------------------------------------------------------------------- /screenshots/config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magespecialist/m2-MSP_ReCaptcha/HEAD/screenshots/config.png -------------------------------------------------------------------------------- /screenshots/frontend.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magespecialist/m2-MSP_ReCaptcha/HEAD/screenshots/frontend.png -------------------------------------------------------------------------------- /screenshots/frontend_register.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magespecialist/m2-MSP_ReCaptcha/HEAD/screenshots/frontend_register.png -------------------------------------------------------------------------------- /screenshots/invisible_recaptcha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magespecialist/m2-MSP_ReCaptcha/HEAD/screenshots/invisible_recaptcha.png -------------------------------------------------------------------------------- /screenshots/invisible_recaptcha2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/magespecialist/m2-MSP_ReCaptcha/HEAD/screenshots/invisible_recaptcha2.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Important notice 2 | 3 | This module has officially moved to the Magento2 github repo as part of Magento2 itself. 4 | 5 | Please check here: https://github.com/magento/magespecialist_ReCaptcha/ . 6 | 7 | You can always use `composer` to upgrade it, but you may need to change your version constraint to `2.*`. 8 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ### Preconditions 4 | 5 | 6 | 1. 7 | 2. 8 | 9 | ### Steps to reproduce 10 | 11 | 1. 12 | 2. 13 | 3. 14 | 15 | ### Expected result 16 | 17 | 1. 18 | 19 | ### Actual result 20 | 21 | 1. [Screenshot, logs] 22 | 23 | 24 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "msp/recaptcha", 3 | "description": "Google reCaptcha integration for Magento2 - Member of MageSpecialist SecuritySuite", 4 | "require": { 5 | "php": "^7.0|^7.1", 6 | "msp/security-suite-common": "^2.0", 7 | "magento/magento-composer-installer": "*", 8 | "google/recaptcha": "^1.1" 9 | }, 10 | "suggest": { 11 | "msp/security-suite": "Full MageSpecialist Security Suite" 12 | }, 13 | "authors": [ 14 | { 15 | "name": "Riccardo Tempesta", 16 | "email": "riccardo.tempesta@magespecialist.it" 17 | } 18 | ], 19 | "type": "magento2-module", 20 | "license": "OSL-3.0", 21 | "autoload": { 22 | "files": [ 23 | "registration.php" 24 | ], 25 | "psr-4": { 26 | "MSP\\ReCaptcha\\": "" 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /view/adminhtml/web/css/msp_recaptcha.less: -------------------------------------------------------------------------------- 1 | /** 2 | * MageSpecialist 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Open Software License (OSL 3.0) 7 | * that is bundled with this package in the file LICENSE.txt. 8 | * It is also available through the world-wide-web at this URL: 9 | * http://opensource.org/licenses/osl-3.0.php 10 | * If you did not receive a copy of the license and are unable to 11 | * obtain it through the world-wide-web, please send an email 12 | * to info@magespecialist.it so we can send you a copy immediately. 13 | * 14 | * @category MSP 15 | * @package MSP_ReCaptcha 16 | * @copyright Copyright (c) 2017 Skeeller srl (http://www.magespecialist.it) 17 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 18 | */ 19 | 20 | .login-content { 21 | .field-recaptcha { 22 | padding-left: 22px !important; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /view/frontend/web/css/source/_module.less: -------------------------------------------------------------------------------- 1 | /** 2 | * MageSpecialist 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Open Software License (OSL 3.0) 7 | * that is bundled with this package in the file LICENSE.txt. 8 | * It is also available through the world-wide-web at this URL: 9 | * http://opensource.org/licenses/osl-3.0.php 10 | * If you did not receive a copy of the license and are unable to 11 | * obtain it through the world-wide-web, please send an email 12 | * to info@magespecialist.it so we can send you a copy immediately. 13 | * 14 | * @category MSP 15 | * @package MSP_ReCaptcha 16 | * @copyright Copyright (c) 2017 Skeeller srl (http://www.magespecialist.it) 17 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 18 | */ 19 | 20 | .login-container, .form-login { 21 | .g-recaptcha { 22 | margin-bottom: 10px !important; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /view/frontend/web/js/registry.js: -------------------------------------------------------------------------------- 1 | /** 2 | * MageSpecialist 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Open Software License (OSL 3.0) 7 | * that is bundled with this package in the file LICENSE.txt. 8 | * It is also available through the world-wide-web at this URL: 9 | * http://opensource.org/licenses/osl-3.0.php 10 | * If you did not receive a copy of the license and are unable to 11 | * obtain it through the world-wide-web, please send an email 12 | * to info@magespecialist.it so we can send you a copy immediately. 13 | * 14 | * @copyright Copyright (c) 2017 Skeeller srl (http://www.magespecialist.it) 15 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 16 | */ 17 | 18 | 'use strict'; 19 | 20 | define(['ko'], function (ko) { 21 | return { 22 | ids: ko.observableArray([]), 23 | captchaList: ko.observableArray([]), 24 | tokenFields: ko.observableArray([]) 25 | }; 26 | }); 27 | -------------------------------------------------------------------------------- /registration.php: -------------------------------------------------------------------------------- 1 | 21 | 22 |
28 |
29 |
30 | 31 | -------------------------------------------------------------------------------- /etc/module.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Model/Provider/FailureProviderInterface.php: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 34 | -------------------------------------------------------------------------------- /view/adminhtml/layout/adminhtml_auth_forgotpassword.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /etc/adminhtml/events.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /view/adminhtml/layout/adminhtml_auth_login.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Plugin/ExcludeFromMinification.php: -------------------------------------------------------------------------------- 1 | 'normal', 'label' => __('Normal')], 34 | ['value' => 'compact', 'label' => __('Compact')], 35 | ]; 36 | } 37 | 38 | /** 39 | * Get options in "key-value" format 40 | * 41 | * @return array 42 | */ 43 | public function toArray() 44 | { 45 | $options = $this->toOptionArray(); 46 | $return = []; 47 | 48 | foreach ($options as $option) { 49 | $return[$option['value']] = $option['label']; 50 | } 51 | 52 | return $return; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Model/Config/Source/Theme.php: -------------------------------------------------------------------------------- 1 | 'light', 'label' => __('Light Theme')], 34 | ['value' => 'dark', 'label' => __('Dark Theme')], 35 | ]; 36 | } 37 | 38 | /** 39 | * Get options in "key-value" format 40 | * 41 | * @return array 42 | */ 43 | public function toArray() 44 | { 45 | $options = $this->toOptionArray(); 46 | $return = []; 47 | 48 | foreach ($options as $option) { 49 | $return[$option['value']] = $option['label']; 50 | } 51 | 52 | return $return; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Model/Config/Source/Position.php: -------------------------------------------------------------------------------- 1 | 'inline', 'label' => __('Inline')], 34 | ['value' => 'bottomright ', 'label' => __('Bottom Right')], 35 | ['value' => 'bottomleft', 'label' => __('Bottom Left')], 36 | ]; 37 | } 38 | 39 | /** 40 | * Get options in "key-value" format 41 | * 42 | * @return array 43 | */ 44 | public function toArray() 45 | { 46 | $options = $this->toOptionArray(); 47 | $return = []; 48 | 49 | foreach ($options as $option) { 50 | $return[$option['value']] = $option['label']; 51 | } 52 | 53 | return $return; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Model/Provider/Response/DefaultResponseProvider.php: -------------------------------------------------------------------------------- 1 | request = $request; 41 | } 42 | 43 | /** 44 | * Handle reCaptcha failure 45 | * @return string 46 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) 47 | */ 48 | public function execute() 49 | { 50 | return $this->request->getParam(ValidateInterface::PARAM_RECAPTCHA_RESPONSE); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Model/Config/Source/Type.php: -------------------------------------------------------------------------------- 1 | 'recaptcha', 'label' => __('reCaptcha v2')], 37 | ['value' => 'invisible', 'label' => __('Invisible reCaptcha')], 38 | ]; 39 | } 40 | 41 | /** 42 | * Get options in "key-value" format 43 | * 44 | * @return array 45 | */ 46 | public function toArray() 47 | { 48 | $options = $this->toOptionArray(); 49 | $return = []; 50 | 51 | foreach ($options as $option) { 52 | $return[$option['value']] = $option['label']; 53 | } 54 | 55 | return $return; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /etc/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 0 28 | normal 29 | light 30 | 31 | 32 | 0 33 | normal 34 | standard 35 | inline 36 | light 37 | 38 | 1 39 | 1 40 | 1 41 | 1 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /etc/acl.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /view/frontend/web/js/ui-messages-mixin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * MageSpecialist 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Open Software License (OSL 3.0) 7 | * that is bundled with this package in the file LICENSE.txt. 8 | * It is also available through the world-wide-web at this URL: 9 | * http://opensource.org/licenses/osl-3.0.php 10 | * If you did not receive a copy of the license and are unable to 11 | * obtain it through the world-wide-web, please send an email 12 | * to info@magespecialist.it so we can send you a copy immediately. 13 | * 14 | * @copyright Copyright (c) 2017 Skeeller srl (http://www.magespecialist.it) 15 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 16 | */ 17 | 18 | 'use strict'; 19 | 20 | define(['MSP_ReCaptcha/js/registry'], function (registry) { 21 | 22 | return function (originalComponent) { 23 | return originalComponent.extend({ 24 | /** 25 | * Initialize reset on messages 26 | * @returns {initialize} 27 | */ 28 | initialize: function () { 29 | this._super(); 30 | 31 | this.messageContainer.errorMessages.subscribe(function () { 32 | var 33 | i, 34 | captchaList = registry.captchaList(), 35 | tokenFieldsList = registry.tokenFields(); 36 | 37 | for (i = 0; i < captchaList.length; i++) { 38 | // eslint-disable-next-line no-undef 39 | grecaptcha.reset(captchaList[i]); 40 | 41 | if (tokenFieldsList[i]) { 42 | tokenFieldsList[i].value = ''; 43 | } 44 | } 45 | }, null, 'arrayChange'); 46 | 47 | return this; 48 | } 49 | }); 50 | }; 51 | }); 52 | -------------------------------------------------------------------------------- /Model/Provider/Failure/AuthenticationExceptionFailure.php: -------------------------------------------------------------------------------- 1 | config = $config; 43 | } 44 | 45 | /** 46 | * Handle reCaptcha failure 47 | * @param ResponseInterface $response 48 | * @return void 49 | * @throws AuthenticationException 50 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) 51 | */ 52 | public function execute(ResponseInterface $response = null) 53 | { 54 | throw new AuthenticationException($this->config->getErrorDescription()); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /view/frontend/layout/contact_index_index.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | MSP_ReCaptcha/js/reCaptcha 35 | contact 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /view/frontend/layout/customer_account_login.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | MSP_ReCaptcha/js/reCaptcha 35 | login 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /view/frontend/layout/customer_account_create.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | MSP_ReCaptcha/js/reCaptcha 35 | create 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /view/frontend/layout/customer_account_forgotpassword.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 29 | 30 | 31 | 32 | 33 | 34 | MSP_ReCaptcha/js/reCaptcha 35 | forgot 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Model/Provider/Failure/RedirectUrl/BeforeAuthUrlProvider.php: -------------------------------------------------------------------------------- 1 | sessionManager = $sessionManager; 49 | $this->url = $url; 50 | } 51 | 52 | /** 53 | * Get redirection URL 54 | * @return string 55 | */ 56 | public function execute() 57 | { 58 | $beforeUrl = $this->sessionManager->getBeforeAuthUrl(); 59 | return $beforeUrl ?: $this->url->getLoginUrl(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Model/Provider/Failure/RedirectUrl/SimpleUrlProvider.php: -------------------------------------------------------------------------------- 1 | urlPath = $urlPath; 55 | $this->urlParams = $urlParams; 56 | $this->url = $url; 57 | } 58 | 59 | /** 60 | * Get redirection URL 61 | * @return string 62 | */ 63 | public function execute() 64 | { 65 | return $this->url->getUrl($this->urlPath, $this->urlParams); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /etc/frontend/events.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Model/Validate.php: -------------------------------------------------------------------------------- 1 | config = $config; 41 | } 42 | 43 | /** 44 | * Return true if reCaptcha validation has passed 45 | * @param string $reCaptchaResponse 46 | * @param string $remoteIp 47 | * @return bool 48 | */ 49 | public function validate($reCaptchaResponse, $remoteIp) 50 | { 51 | $secret = $this->config->getPrivateKey(); 52 | 53 | if ($reCaptchaResponse) { 54 | // @codingStandardsIgnoreStart 55 | $reCaptcha = new ReCaptcha($secret); 56 | // @codingStandardsIgnoreEmd 57 | 58 | $res = $reCaptcha->verify($reCaptchaResponse, $remoteIp); 59 | 60 | if ($res->isSuccess()) { 61 | return true; 62 | } 63 | } 64 | 65 | return false; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Model/LayoutSettings.php: -------------------------------------------------------------------------------- 1 | config = $config; 39 | } 40 | 41 | /** 42 | * Return captcha config for frontend 43 | * @return array 44 | */ 45 | public function getCaptchaSettings() 46 | { 47 | return [ 48 | 'siteKey' => $this->config->getPublicKey(), 49 | 'size' => $this->config->getFrontendSize(), 50 | 'badge' => $this->config->getFrontendPosition(), 51 | 'theme' => $this->config->getFrontendTheme(), 52 | 'lang' => $this->config->getLanguageCode(), 53 | 'enabled' => [ 54 | 'login' => $this->config->isEnabledFrontendLogin(), 55 | 'create' => $this->config->isEnabledFrontendCreate(), 56 | 'forgot' => $this->config->isEnabledFrontendForgot(), 57 | 'contact' => $this->config->isEnabledFrontendContact(), 58 | ] 59 | ]; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Block/LayoutProcessor/Checkout/Onepage.php: -------------------------------------------------------------------------------- 1 | layoutSettings = $layoutSettings; 41 | } 42 | 43 | /** 44 | * Process js Layout of block 45 | * 46 | * @param array $jsLayout 47 | * @return array 48 | */ 49 | public function process($jsLayout) 50 | { 51 | $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children'] 52 | ['shippingAddress']['children']['customer-email']['children'] 53 | ['msp_recaptcha']['settings'] = $this->layoutSettings->getCaptchaSettings(); 54 | 55 | $jsLayout['components']['checkout']['children']['authentication']['children'] 56 | ['msp_recaptcha']['settings'] = $this->layoutSettings->getCaptchaSettings(); 57 | 58 | return $jsLayout; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Model/Provider/Response/AjaxResponseProvider.php: -------------------------------------------------------------------------------- 1 | request = $request; 49 | $this->decoder = $decoder; 50 | } 51 | 52 | /** 53 | * Handle reCaptcha failure 54 | * @return string 55 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) 56 | */ 57 | public function execute() 58 | { 59 | if ($content = $this->request->getContent()) { 60 | try { 61 | $jsonParams = $this->decoder->decode($content); 62 | if (isset($jsonParams['g-recaptcha-response'])) { 63 | return $jsonParams['g-recaptcha-response']; 64 | } 65 | } catch (\Exception $e) { 66 | return ''; 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /view/frontend/layout/default.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | MSP_ReCaptcha/js/reCaptcha 34 | additional-login-form-fields 35 | checkoutConfig 36 | msp-recaptcha-popup-login 37 | login 38 | inline 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Block/Adminhtml/ReCaptcha.php: -------------------------------------------------------------------------------- 1 | data = $data; 51 | $this->config = $config; 52 | } 53 | 54 | /** 55 | * Get public reCaptcha key 56 | * @return string 57 | */ 58 | public function getPublicKey() 59 | { 60 | return $this->config->getPublicKey(); 61 | } 62 | 63 | /** 64 | * Get backend theme 65 | * @return string 66 | */ 67 | public function getTheme() 68 | { 69 | return $this->config->getBackendTheme(); 70 | } 71 | 72 | /** 73 | * Get backend size 74 | * @return string 75 | */ 76 | public function getSize() 77 | { 78 | return $this->config->getBackendSize(); 79 | } 80 | 81 | /** 82 | * Return true if can display reCaptcha 83 | * @return bool 84 | */ 85 | public function canDisplayCaptcha() 86 | { 87 | return $this->config->isEnabledBackend(); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Model/Provider/Failure/AjaxResponseFailure.php: -------------------------------------------------------------------------------- 1 | actionFlag = $actionFlag; 59 | $this->encoder = $encoder; 60 | $this->config = $config; 61 | } 62 | 63 | /** 64 | * Handle reCaptcha failure 65 | * @param ResponseInterface $response 66 | * @return void 67 | */ 68 | public function execute(ResponseInterface $response = null) 69 | { 70 | $this->actionFlag->set('', Action::FLAG_NO_DISPATCH, true); 71 | 72 | $jsonPayload = $this->encoder->encode([ 73 | 'errors' => true, 74 | 'message' => $this->config->getErrorDescription(), 75 | ]); 76 | $response->representJson($jsonPayload); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Plugin/Block/Account/AuthenticationPopupPlugin.php: -------------------------------------------------------------------------------- 1 | encoder = $encoder; 56 | $this->decoder = $decoder; 57 | $this->layoutSettings = $layoutSettings; 58 | } 59 | 60 | /** 61 | * @param \Magento\Customer\Block\Account\AuthenticationPopup $subject 62 | * @param array $result 63 | * @return string 64 | * @SuppressWarnings(PHPMD.UnusedFormalParameter) 65 | */ 66 | public function afterGetJsLayout(\Magento\Customer\Block\Account\AuthenticationPopup $subject, $result) 67 | { 68 | $layout = $this->decoder->decode($result); 69 | $layout['components']['authenticationPopup']['children']['msp_recaptcha']['settings'] = 70 | $this->layoutSettings->getCaptchaSettings(); 71 | 72 | return $this->encoder->encode($layout); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Command/ReCaptcha.php: -------------------------------------------------------------------------------- 1 | config = $config; 53 | $this->cacheManager = $cacheManager; 54 | } 55 | 56 | /** 57 | * @inheritdoc 58 | */ 59 | protected function configure() 60 | { 61 | $this->setName('msp:security:recaptcha:disable'); 62 | $this->setDescription('Disable backend reCaptcha'); 63 | 64 | parent::configure(); 65 | } 66 | 67 | /** 68 | * @inheritdoc 69 | * @SuppressWarnings("PHPMD.UnusedFormalParameter") 70 | */ 71 | protected function execute(InputInterface $input, OutputInterface $output) 72 | { 73 | $this->config->saveConfig( 74 | Config::XML_PATH_ENABLED_BACKEND, 75 | '0', 76 | 'default', 77 | 0 78 | ); 79 | 80 | $this->cacheManager->flush(['config']); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /etc/di.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | MSP\ReCaptcha\Command\ReCaptcha 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 41 | 42 | 44 | 45 | 46 | 47 | 48 | 49 | 1 50 | 1 51 | 52 | 53 | 1 54 | 1 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Block/Frontend/ReCaptcha.php: -------------------------------------------------------------------------------- 1 | data = $data; 73 | $this->decoder = $decoder; 74 | $this->encoder = $encoder; 75 | $this->layoutSettings = $layoutSettings; 76 | } 77 | 78 | /** 79 | * Get public reCaptcha key 80 | * @return string 81 | */ 82 | public function getPublicKey() 83 | { 84 | return $this->config->getPublicKey(); 85 | } 86 | 87 | /** 88 | * @inheritdoc 89 | */ 90 | public function getJsLayout() 91 | { 92 | $layout = $this->decoder->decode(parent::getJsLayout()); 93 | $layout['components']['msp-recaptcha']['settings'] = $this->layoutSettings->getCaptchaSettings(); 94 | return $this->encoder->encode($layout); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Model/Provider/Failure/ObserverRedirectFailure.php: -------------------------------------------------------------------------------- 1 | messageManager = $messageManager; 74 | $this->actionFlag = $actionFlag; 75 | $this->config = $config; 76 | $this->redirectUrlProvider = $redirectUrlProvider; 77 | $this->url = $url; 78 | } 79 | 80 | /** 81 | * Get redirect URL 82 | * @return string 83 | */ 84 | private function getUrl() 85 | { 86 | return $this->redirectUrlProvider->execute(); 87 | } 88 | 89 | /** 90 | * Handle reCaptcha failure 91 | * @param ResponseInterface $response 92 | * @return void 93 | */ 94 | public function execute(ResponseInterface $response = null) 95 | { 96 | $this->messageManager->addErrorMessage($this->config->getErrorDescription()); 97 | $this->actionFlag->set('', Action::FLAG_NO_DISPATCH, true); 98 | 99 | $response->setRedirect($this->getUrl()); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /Observer/ReCaptchaObserver.php: -------------------------------------------------------------------------------- 1 | responseProvider = $responseProvider; 74 | $this->validate = $validate; 75 | $this->failureProvider = $failureProvider; 76 | $this->remoteAddress = $remoteAddress; 77 | $this->isCheckRequired = $isCheckRequired; 78 | } 79 | 80 | /** 81 | * @param Observer $observer 82 | * @return void 83 | */ 84 | public function execute(Observer $observer) 85 | { 86 | if ($this->isCheckRequired->execute()) { 87 | $reCaptchaResponse = $this->responseProvider->execute(); 88 | $remoteIp = $this->remoteAddress->getRemoteAddress(); 89 | 90 | /** @var \Magento\Framework\App\Action\Action $controller */ 91 | $controller = $observer->getControllerAction(); 92 | 93 | if (!$this->validate->validate($reCaptchaResponse, $remoteIp)) { 94 | $this->failureProvider->execute($controller ? $controller->getResponse(): null); 95 | } 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /etc/adminhtml/di.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 29 | 30 | adminhtml 31 | 32 | 33 | 35 | 36 | MSP\ReCaptcha\Model\Provider\IsCheckRequired\Adminhtml\Login 38 | MSP\ReCaptcha\Model\Provider\Failure\AuthenticationExceptionFailure 40 | 41 | 42 | 43 | 44 | 46 | 47 | */*/forgotpassword 48 | 49 | 50 | 52 | 53 | MSP\ReCaptcha\Model\Provider\Failure\RedirectUrl\ForgotPassword 55 | 56 | 57 | 59 | 60 | adminhtml 61 | email 62 | 63 | 64 | 66 | 67 | MSP\ReCaptcha\Model\Provider\IsCheckRequired\Adminhtml\ForgotPassword 69 | MSP\ReCaptcha\Model\Provider\Failure\ForgotPasswordObserver 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /Setup/UpgradeData.php: -------------------------------------------------------------------------------- 1 | scopeConfig = $scopeConfig; 43 | } 44 | 45 | /** 46 | * Move config from srcPath to dstPath 47 | * @param ModuleDataSetupInterface $setup 48 | * @param string $srcPath 49 | * @param string $dstPath 50 | */ 51 | private function moveConfig(ModuleDataSetupInterface $setup, $srcPath, $dstPath) 52 | { 53 | $value = $this->scopeConfig->getValue($srcPath); 54 | 55 | if (is_array($value)) { 56 | foreach (array_keys($value) as $k) { 57 | $this->moveConfig($setup, $srcPath . '/' . $k, $dstPath . '/' . $k); 58 | } 59 | } else { 60 | $connection = $setup->getConnection(); 61 | $configData = $setup->getTable('core_config_data'); 62 | $connection->update($configData, ['path' => $dstPath], 'path='.$connection->quote($srcPath)); 63 | } 64 | } 65 | 66 | private function upgradeTo010100(ModuleDataSetupInterface $setup) 67 | { 68 | $this->moveConfig( 69 | $setup, 70 | 'msp_securitysuite/recaptcha', 71 | 'msp_securitysuite_recaptcha/general' 72 | ); 73 | } 74 | 75 | private function upgradeTo010101(ModuleDataSetupInterface $setup) 76 | { 77 | $this->moveConfig( 78 | $setup, 79 | 'msp_securitysuite_recaptcha/general/enabled_frontend', 80 | 'msp_securitysuite_recaptcha/frontend/enabled' 81 | ); 82 | $this->moveConfig( 83 | $setup, 84 | 'msp_securitysuite_recaptcha/general/enabled_backend', 85 | 'msp_securitysuite_recaptcha/backend/enabled' 86 | ); 87 | } 88 | 89 | /** 90 | * Upgrades data for a module 91 | * 92 | * @param ModuleDataSetupInterface $setup 93 | * @param ModuleContextInterface $context 94 | * @return void 95 | */ 96 | public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) 97 | { 98 | $setup->startSetup(); 99 | 100 | if (version_compare($context->getVersion(), '1.1.0') < 0) { 101 | $this->upgradeTo010100($setup); 102 | } 103 | 104 | if (version_compare($context->getVersion(), '1.2.0') < 0) { 105 | $this->upgradeTo010101($setup); 106 | } 107 | 108 | $setup->endSetup(); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /Model/IsCheckRequired.php: -------------------------------------------------------------------------------- 1 | scopeConfig = $scopeConfig; 77 | $this->config = $config; 78 | $this->enableConfigFlag = $enableConfigFlag; 79 | $this->requireRequestParam = $requireRequestParam; 80 | $this->area = $area; 81 | $this->request = $request; 82 | 83 | if (!in_array($this->area, [Area::AREA_FRONTEND, Area::AREA_ADMINHTML])) { 84 | throw new \InvalidArgumentException('Area parameter must be one of frontend or adminhtml'); 85 | } 86 | } 87 | 88 | /** 89 | * Return true if area is configured to be active 90 | * @return bool 91 | */ 92 | private function isAreaEnabled() 93 | { 94 | return 95 | (($this->area === Area::AREA_ADMINHTML) && $this->config->isEnabledBackend()) || 96 | (($this->area === Area::AREA_FRONTEND) && $this->config->isEnabledFrontend()); 97 | } 98 | 99 | /** 100 | * Return true if current zone is enabled 101 | * @return bool 102 | */ 103 | private function isZoneEnabled() 104 | { 105 | return !$this->enableConfigFlag || $this->scopeConfig->getValue($this->enableConfigFlag); 106 | } 107 | 108 | /** 109 | * Return true if request if valid 110 | * @return bool 111 | */ 112 | private function isRequestValid() 113 | { 114 | return !$this->requireRequestParam || $this->request->getParam($this->requireRequestParam); 115 | } 116 | 117 | /** 118 | * Return true if check is required 119 | * @return bool 120 | */ 121 | public function execute() 122 | { 123 | return 124 | $this->isAreaEnabled() && 125 | $this->isZoneEnabled() && 126 | $this->isRequestValid(); 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /view/frontend/layout/checkout_index_index.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | MSP_ReCaptcha/js/reCaptcha 42 | additional-login-form-fields 43 | checkoutConfig 44 | msp-recaptcha-checkout-inline-login 45 | login 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | MSP_ReCaptcha/js/reCaptcha 60 | additional-login-form-fields 61 | checkoutConfig 62 | msp-recaptcha-checkout-login 63 | login 64 | inline 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /view/frontend/web/js/reCaptcha.js: -------------------------------------------------------------------------------- 1 | /** 2 | * MageSpecialist 3 | * 4 | * NOTICE OF LICENSE 5 | * 6 | * This source file is subject to the Open Software License (OSL 3.0) 7 | * that is bundled with this package in the file LICENSE.txt. 8 | * It is also available through the world-wide-web at this URL: 9 | * http://opensource.org/licenses/osl-3.0.php 10 | * If you did not receive a copy of the license and are unable to 11 | * obtain it through the world-wide-web, please send an email 12 | * to info@magespecialist.it so we can send you a copy immediately. 13 | * 14 | * @copyright Copyright (c) 2017 Skeeller srl (http://www.magespecialist.it) 15 | * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) 16 | */ 17 | 18 | 'use strict'; 19 | 20 | define( 21 | [ 22 | 'uiComponent', 23 | 'jquery', 24 | 'ko', 25 | 'MSP_ReCaptcha/js/registry', 26 | 'https://www.google.com/recaptcha/api.js' 27 | ], 28 | function (Component, $, ko, registry) { 29 | 30 | return Component.extend({ 31 | defaults: { 32 | template: 'MSP_ReCaptcha/reCaptcha' 33 | }, 34 | 35 | /** 36 | * Return true if reCaptcha is visible 37 | * @returns {Boolean} 38 | */ 39 | getIsVisible: function () { 40 | return this.settings.enabled[this.zone]; 41 | }, 42 | 43 | /** 44 | * Recaptcha callback 45 | * @param {String} token 46 | */ 47 | reCaptchaCallback: function (token) { 48 | if (this.settings.size === 'invisible') { 49 | this.tokenField.value = token; 50 | this.$parentForm.submit(); 51 | } 52 | }, 53 | 54 | /** 55 | * Initialize reCaptcha after first rendering 56 | */ 57 | initCaptcha: function () { 58 | var me = this, 59 | $parentForm, 60 | $wrapper, 61 | $reCaptcha, 62 | widgetId, 63 | listeners, 64 | renderOptions; 65 | 66 | if (this.captchaInitialized) { 67 | return; 68 | } 69 | 70 | this.captchaInitialized = true; 71 | 72 | /* 73 | * Workaround for data-bind issue: 74 | * We cannot use data-bind to link a dynamic id to our component 75 | * See: https://stackoverflow.com/questions/46657573/recaptcha-the-bind-parameter-must-be-an-element-or-id 76 | * 77 | * We create a wrapper element with a wrapping id and we inject the real ID with jQuery. 78 | * In this way we have no data-bind attribute at all in our reCaptcha div 79 | */ 80 | $wrapper = $('#' + this.getReCaptchaId() + '-wrapper'); 81 | $reCaptcha = $wrapper.find('.g-recaptcha'); 82 | $reCaptcha.attr('id', this.getReCaptchaId()); 83 | 84 | $parentForm = $wrapper.parents('form'); 85 | me = this; 86 | 87 | renderOptions = { 88 | 'sitekey': this.settings.siteKey, 89 | 'theme': this.settings.theme, 90 | 'size': this.settings.size, 91 | 'badge': this.badge ? this.badge : this.settings.badge, 92 | 'callback': function (token) { // jscs:ignore jsDoc 93 | me.reCaptchaCallback(token); 94 | } 95 | }; 96 | 97 | if (this.settings.lang) { 98 | renderOptions['hl'] = this.settings.lang; 99 | } 100 | 101 | // eslint-disable-next-line no-undef 102 | widgetId = grecaptcha.render(this.getReCaptchaId(), renderOptions); 103 | 104 | if (this.settings.size === 'invisible') { 105 | $parentForm.submit(function (event) { 106 | if (!me.tokenField.value) { 107 | // eslint-disable-next-line no-undef 108 | grecaptcha.execute(widgetId); 109 | event.preventDefault(event); 110 | event.stopImmediatePropagation(); 111 | } 112 | }); 113 | 114 | // Move our (last) handler topmost. We need this to avoid submit bindings with ko. 115 | listeners = $._data($parentForm[0], 'events').submit; 116 | listeners.unshift(listeners.pop()); 117 | 118 | // Create a virtual token field 119 | this.tokenField = $('')[0]; 120 | this.$parentForm = $parentForm; 121 | $parentForm.append(this.tokenField); 122 | } else { 123 | this.tokenField = null; 124 | } 125 | 126 | registry.ids.push(this.getReCaptchaId()); 127 | registry.captchaList.push(widgetId); 128 | registry.tokenFields.push(this.tokenField); 129 | 130 | }, 131 | 132 | /** 133 | * Render reCaptcha 134 | */ 135 | renderReCaptcha: function () { 136 | var me = this; 137 | 138 | if (this.getIsVisible()) { 139 | var initCaptchaInterval = setInterval(function () { 140 | if (window.grecaptcha) { 141 | clearInterval(initCaptchaInterval); 142 | me.initCaptcha(); 143 | } 144 | }, 100); 145 | } 146 | }, 147 | 148 | /** 149 | * Get reCaptcha ID 150 | * @returns {String} 151 | */ 152 | getReCaptchaId: function () { 153 | if (!this.reCaptchaId) { 154 | return 'msp-recaptcha'; 155 | } 156 | 157 | return this.reCaptchaId; 158 | } 159 | }); 160 | } 161 | ); 162 | -------------------------------------------------------------------------------- /Model/Config.php: -------------------------------------------------------------------------------- 1 | scopeConfig = $scopeConfig; 63 | } 64 | 65 | /** 66 | * Get error 67 | * @return Phrase 68 | */ 69 | public function getErrorDescription() 70 | { 71 | return __('Incorrect reCAPTCHA'); 72 | } 73 | 74 | /** 75 | * Get google recaptcha public key 76 | * @return string 77 | */ 78 | public function getPublicKey() 79 | { 80 | return trim($this->scopeConfig->getValue(static::XML_PATH_PUBLIC_KEY)); 81 | } 82 | 83 | /** 84 | * Get google recaptcha private key 85 | * @return string 86 | */ 87 | public function getPrivateKey() 88 | { 89 | return trim($this->scopeConfig->getValue(static::XML_PATH_PRIVATE_KEY)); 90 | } 91 | 92 | /** 93 | * Return true if enabled on backend 94 | * @return bool 95 | */ 96 | public function isEnabledBackend() 97 | { 98 | if (!$this->getPrivateKey() || !$this->getPublicKey()) { 99 | return false; 100 | } 101 | 102 | return (bool) $this->scopeConfig->getValue(static::XML_PATH_ENABLED_BACKEND); 103 | } 104 | 105 | /** 106 | * Return true if enabled on frontend 107 | * @return bool 108 | */ 109 | public function isEnabledFrontend() 110 | { 111 | if (!$this->getPrivateKey() || !$this->getPublicKey()) { 112 | return false; 113 | } 114 | 115 | return (bool) $this->scopeConfig->getValue(static::XML_PATH_ENABLED_FRONTEND); 116 | } 117 | 118 | /** 119 | * Return true if enabled on frontend login 120 | * @return bool 121 | */ 122 | public function isEnabledFrontendLogin() 123 | { 124 | if (!$this->isEnabledFrontend()) { 125 | return false; 126 | } 127 | 128 | return (bool) $this->scopeConfig->getValue(static::XML_PATH_ENABLED_FRONTEND_LOGIN); 129 | } 130 | 131 | /** 132 | * Return true if enabled on frontend forgot password 133 | * @return bool 134 | */ 135 | public function isEnabledFrontendForgot() 136 | { 137 | if (!$this->isEnabledFrontend()) { 138 | return false; 139 | } 140 | 141 | return (bool) $this->scopeConfig->getValue(static::XML_PATH_ENABLED_FRONTEND_FORGOT); 142 | } 143 | 144 | /** 145 | * Return true if enabled on frontend contact 146 | * @return bool 147 | */ 148 | public function isEnabledFrontendContact() 149 | { 150 | if (!$this->isEnabledFrontend()) { 151 | return false; 152 | } 153 | 154 | return (bool) $this->scopeConfig->getValue(static::XML_PATH_ENABLED_FRONTEND_CONTACT); 155 | } 156 | 157 | /** 158 | * Return true if enabled on frontend create user 159 | * @return bool 160 | */ 161 | public function isEnabledFrontendCreate() 162 | { 163 | if (!$this->isEnabledFrontend()) { 164 | return false; 165 | } 166 | 167 | return (bool) $this->scopeConfig->getValue(static::XML_PATH_ENABLED_FRONTEND_CREATE); 168 | } 169 | 170 | /** 171 | * Get data size 172 | * @return string 173 | */ 174 | public function getFrontendSize() 175 | { 176 | if ($this->getFrontendType() == Type::TYPE_INVISIBLE) { 177 | return 'invisible'; 178 | } 179 | 180 | return $this->scopeConfig->getValue(static::XML_PATH_SIZE_FRONTEND); 181 | } 182 | 183 | /** 184 | * Get data size 185 | * @return string 186 | */ 187 | public function getBackendSize() 188 | { 189 | return $this->scopeConfig->getValue(static::XML_PATH_SIZE_BACKEND); 190 | } 191 | 192 | /** 193 | * Get data size 194 | * @return string 195 | */ 196 | public function getFrontendTheme() 197 | { 198 | if ($this->getFrontendType() == Type::TYPE_INVISIBLE) { 199 | return null; 200 | } 201 | 202 | return $this->scopeConfig->getValue(static::XML_PATH_THEME_FRONTEND); 203 | } 204 | 205 | /** 206 | * Get data size 207 | * @return string 208 | */ 209 | public function getBackendTheme() 210 | { 211 | return $this->scopeConfig->getValue(static::XML_PATH_THEME_BACKEND); 212 | } 213 | 214 | /** 215 | * Get data size 216 | * @return string 217 | */ 218 | public function getFrontendPosition() 219 | { 220 | if ($this->getFrontendType() != Type::TYPE_INVISIBLE) { 221 | return null; 222 | } 223 | 224 | return $this->scopeConfig->getValue(static::XML_PATH_POSITION_FRONTEND); 225 | } 226 | 227 | /** 228 | * Get data size 229 | * @return string 230 | */ 231 | public function getFrontendType() 232 | { 233 | return $this->scopeConfig->getValue(static::XML_PATH_TYPE_FRONTEND); 234 | } 235 | 236 | /** 237 | * Get language code 238 | * @return string 239 | */ 240 | public function getLanguageCode() 241 | { 242 | return $this->scopeConfig->getValue(static::XML_PATH_LANGUAGE_CODE, ScopeInterface::SCOPE_STORE); 243 | } 244 | } 245 | -------------------------------------------------------------------------------- /etc/adminhtml/system.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 |
27 | separator-top 28 | 29 | msp_securitysuite 30 | MSP_ReCaptcha::config 31 | 32 | 34 | 35 | 37 | 38 | 39 | 41 | 42 | 43 | 44 | 46 | 47 | 49 | 50 | Magento\Config\Model\Config\Source\Yesno 51 | 52 | 54 | 55 | MSP\ReCaptcha\Model\Config\Source\Theme 56 | 57 | 1 58 | recaptcha 59 | 60 | 61 | 63 | 64 | MSP\ReCaptcha\Model\Config\Source\Size 65 | 66 | 1 67 | recaptcha 68 | 69 | 70 | 71 | 73 | 74 | 76 | 77 | Magento\Config\Model\Config\Source\Yesno 78 | 79 | 81 | 82 | MSP\ReCaptcha\Model\Config\Source\Type 83 | 84 | 1 85 | 86 | 87 | 89 | 90 | MSP\ReCaptcha\Model\Config\Source\Position 91 | 92 | 1 93 | invisible 94 | 95 | 96 | 98 | 99 | MSP\ReCaptcha\Model\Config\Source\Theme 100 | 101 | 1 102 | recaptcha 103 | 104 | 105 | 107 | 108 | 110 | Optional. Forces the widget to render in a specific language. Auto-detects the user's language if unspecified.
111 | See supported Language codes. 112 | 113 | ]]>
114 | 115 | 1 116 | 117 |
118 | 120 | 121 | MSP\ReCaptcha\Model\Config\Source\Size 122 | 123 | 1 124 | recaptcha 125 | 126 | 127 | 129 | 130 | Magento\Config\Model\Config\Source\Yesno 131 | 132 | 1 133 | 134 | 135 | 137 | 138 | Magento\Config\Model\Config\Source\Yesno 139 | 140 | 1 141 | 142 | 143 | 145 | 146 | Magento\Config\Model\Config\Source\Yesno 147 | 148 | 1 149 | 150 | 151 | 153 | 154 | Magento\Config\Model\Config\Source\Yesno 155 | 156 | 1 157 | 158 | 159 |
160 |
161 |
162 |
163 | -------------------------------------------------------------------------------- /etc/frontend/di.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 24 | 25 | 26 | 27 | 28 | \MSP\ReCaptcha\Block\LayoutProcessor\Checkout\Onepage 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | MSP\ReCaptcha\Model\Provider\Failure\RedirectUrl\BeforeAuthUrlProvider 39 | 40 | 41 | 43 | 44 | msp_securitysuite_recaptcha/frontend/enabled_login 46 | frontend 47 | 48 | 49 | 51 | 52 | MSP\ReCaptcha\Model\Provider\IsCheckRequired\Frontend\Login 54 | MSP\ReCaptcha\Model\Provider\Failure\LoginObserver 56 | 57 | 58 | 59 | 60 | 62 | 63 | */*/forgotpassword 64 | 65 | true 66 | 67 | 68 | 69 | 71 | 72 | MSP\ReCaptcha\Model\Provider\Failure\RedirectUrl\ForgotPassword 74 | 75 | 76 | 78 | 79 | msp_securitysuite_recaptcha/frontend/enabled_forgot 81 | frontend 82 | 83 | 84 | 86 | 87 | MSP\ReCaptcha\Model\Provider\IsCheckRequired\Frontend\ForgotPassword 89 | MSP\ReCaptcha\Model\Provider\Failure\ForgotPasswordObserver 91 | 92 | 93 | 94 | 95 | 97 | 98 | */*/create 99 | 100 | true 101 | 102 | 103 | 104 | 106 | 107 | MSP\ReCaptcha\Model\Provider\Failure\RedirectUrl\CreateUser 109 | 110 | 111 | 113 | 114 | msp_securitysuite_recaptcha/frontend/enabled_create 116 | frontend 117 | 118 | 119 | 121 | 122 | MSP\ReCaptcha\Model\Provider\IsCheckRequired\Frontend\CreateUser 124 | MSP\ReCaptcha\Model\Provider\Failure\CreateUserObserver 126 | 127 | 128 | 129 | 130 | 132 | 133 | contact/index/index 134 | 135 | 136 | 138 | 139 | MSP\ReCaptcha\Model\Provider\Failure\RedirectUrl\ContactForm 141 | 142 | 143 | 145 | 146 | msp_securitysuite_recaptcha/frontend/enabled_contact 148 | frontend 149 | 150 | 151 | 153 | 154 | MSP\ReCaptcha\Model\Provider\IsCheckRequired\Frontend\ContactForm 156 | MSP\ReCaptcha\Model\Provider\Failure\ContactFormObserver 158 | 159 | 160 | 161 | 162 | 164 | 165 | MSP\ReCaptcha\Model\Provider\IsCheckRequired\Frontend\Login 167 | MSP\ReCaptcha\Model\Provider\Response\AjaxResponseProvider 169 | MSP\ReCaptcha\Model\Provider\Failure\AjaxResponseFailure 171 | 172 | 173 | 174 | 175 | 177 | 178 | 179 | --------------------------------------------------------------------------------