-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from mageplaza/develop
Develop
- Loading branch information
Showing
8 changed files
with
257 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
/** | ||
* Mageplaza | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Mageplaza.com license that is | ||
* available through the world-wide-web at this URL: | ||
* https://www.mageplaza.com/LICENSE.txt | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this extension to newer | ||
* version in the future. | ||
* | ||
* @category Mageplaza | ||
* @package Mageplaza_GoogleRecaptcha | ||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | ||
* @license https://www.mageplaza.com/LICENSE.txt | ||
*/ | ||
|
||
namespace Mageplaza\GoogleRecaptcha\Console\Adminhtml\Command; | ||
|
||
use Magento\Framework\App\Config\Storage\WriterInterface as ConfigWriter; | ||
use Mageplaza\GoogleRecaptcha\Helper\Data as HelperData; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
/** | ||
* Class Disable | ||
* @package Mageplaza\GoogleRecaptcha\Console\Adminhtml\Command | ||
*/ | ||
class Disable extends Command | ||
{ | ||
/** | ||
* @var HelperData | ||
*/ | ||
protected $helperData; | ||
|
||
/** | ||
* @var ConfigWriter | ||
*/ | ||
protected $_configWriter; | ||
|
||
/** | ||
* Disable constructor. | ||
* | ||
* @param HelperData $helperData | ||
* @param ConfigWriter $configWriter | ||
* @param null $name | ||
*/ | ||
public function __construct( | ||
HelperData $helperData, | ||
ConfigWriter $configWriter, | ||
$name = null | ||
) { | ||
$this->helperData = $helperData; | ||
$this->_configWriter = $configWriter; | ||
|
||
parent::__construct($name); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function configure() | ||
{ | ||
$this->setName('mpgooglerecaptcha:backend:disable') | ||
->setDescription(__('Disable backend captcha')); | ||
|
||
parent::configure(); | ||
} | ||
|
||
/** | ||
* @param InputInterface $input | ||
* @param OutputInterface $output | ||
* | ||
* @return int|void|null | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
if (!$this->helperData->isCaptchaBackend()) { | ||
$output->writeln(__('The captcha is disable for your admin website.')); | ||
} else { | ||
$path = 'googlerecaptcha/backend/enabled'; | ||
$this->_configWriter->save($path, '0'); | ||
$output->writeln(__('The captcha backend has been successfully disabled. Please run the flush cache command again')); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
/** | ||
* Mageplaza | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Mageplaza.com license that is | ||
* available through the world-wide-web at this URL: | ||
* https://www.mageplaza.com/LICENSE.txt | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this extension to newer | ||
* version in the future. | ||
* | ||
* @category Mageplaza | ||
* @package Mageplaza_GoogleRecaptcha | ||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | ||
* @license https://www.mageplaza.com/LICENSE.txt | ||
*/ | ||
|
||
namespace Mageplaza\GoogleRecaptcha\Console\Adminhtml\Command; | ||
|
||
use Magento\Framework\App\Config\Storage\WriterInterface as ConfigWriter; | ||
use Mageplaza\GoogleRecaptcha\Helper\Data as HelperData; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
/** | ||
* Class Enable | ||
* @package Mageplaza\GoogleRecaptcha\Console\Adminhtml\Command | ||
*/ | ||
class Enable extends Command | ||
{ | ||
/** | ||
* @var HelperData | ||
*/ | ||
protected $helperData; | ||
|
||
/** | ||
* @var HelperData | ||
*/ | ||
protected $_configWriter; | ||
|
||
/** | ||
* Enable constructor. | ||
* | ||
* @param HelperData $helperData | ||
* @param ConfigWriter $configWriter | ||
* @param null $name | ||
*/ | ||
public function __construct( | ||
HelperData $helperData, | ||
ConfigWriter $configWriter, | ||
$name = null | ||
) { | ||
$this->helperData = $helperData; | ||
$this->_configWriter = $configWriter; | ||
|
||
parent::__construct($name); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function configure() | ||
{ | ||
$this->setName('mpgooglerecaptcha:backend:enable') | ||
->setDescription(__('Enable backend captcha')); | ||
|
||
parent::configure(); | ||
} | ||
|
||
/** | ||
* @param InputInterface $input | ||
* @param OutputInterface $output | ||
* | ||
* @return int|void|null | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
if ($this->helperData->isCaptchaBackend()) { | ||
$output->writeln(__('The captcha is enabled for your admin website.')); | ||
} else { | ||
$path = 'googlerecaptcha/backend/enabled'; | ||
$this->_configWriter->save($path, '1'); | ||
$output->writeln(__('The captcha backend has been successfully enabled. Please run the flush cache command again')); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,14 +6,14 @@ | |
"google/recaptcha": "^1.2" | ||
}, | ||
"type": "magento2-module", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"license": "proprietary", | ||
"authors": [ | ||
{ | ||
"name": "Mageplaza", | ||
"email": "[email protected]", | ||
"homepage": "https://www.mageplaza.com", | ||
"role": "Technical Support" | ||
"role": "Technical Support " | ||
} | ||
], | ||
"autoload": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Mageplaza | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Mageplaza.com license that is | ||
* available through the world-wide-web at this URL: | ||
* https://www.mageplaza.com/LICENSE.txt | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this extension to newer | ||
* version in the future. | ||
* | ||
* @category Mageplaza | ||
* @package Mageplaza_GoogleRecaptcha | ||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | ||
* @license https://www.mageplaza.com/LICENSE.txt | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> | ||
<type name="Magento\Framework\Console\CommandList"> | ||
<arguments> | ||
<argument name="commands" xsi:type="array"> | ||
<item name="mpgooglerecaptcha_enable" xsi:type="object">Mageplaza\GoogleRecaptcha\Console\Adminhtml\Command\Enable</item> | ||
<item name="mpgooglerecaptcha_disable" xsi:type="object">Mageplaza\GoogleRecaptcha\Console\Adminhtml\Command\Disable</item> | ||
</argument> | ||
</arguments> | ||
</type> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters