diff --git a/COPYING.txt b/COPYING.txt new file mode 100644 index 0000000..91a1fe8 --- /dev/null +++ b/COPYING.txt @@ -0,0 +1,19 @@ +Copyright © 2020-present Wolfsellers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Model/ControllerActionPredispatch.php b/Model/ControllerActionPredispatch.php new file mode 100644 index 0000000..a539fe5 --- /dev/null +++ b/Model/ControllerActionPredispatch.php @@ -0,0 +1,8 @@ +scopeConfig = $scopeConfig; + } + + public function aroundExecute( + MagentoControllerActionPredispatch $subject, + callable $proceed, + Observer $observer + ) { + if($this->scopeConfig->isSetFlag(self::TWOFACTOR_AUTH_ENABLED)) { + $proceed($observer); + } + } +} + diff --git a/README.md b/README.md new file mode 100644 index 0000000..919b01a --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# Magento 2 Module WolfSellers Enable Disable 2FA + + - [Main Functionalities](#markdown-header-main-functionalities) + - [Installation](#markdown-header-installation) + - [Tested](#markdown-header-tested) + + +## Main Functionalities +Adds enable disable feature switch for the Two-factor Authorization for Magento 2.4 + +It can be configured in `Stores > Configuration > 2FA > General > Enabled` by default is set to no, so the admin can be used. +Change it back in production. + +## Installation + +### 1. Composer (recommended) + + - Install the module composer by running `composer require wolfsellers/module-enabledisabletfa` + - Enable the module by running `php bin/magento module:enable WolfSellers_EnableDisableTfa` + - Apply database updates by running `php bin/magento setup:upgrade` + - Flush the cache by running `php bin/magento cache:flush` + +### 2. Download zip (not recommended) + + - Download the zip file from github + - Extract the files in `app/code/WolfSellers/EnableDisableTfa/` + - Enable the module by running `php bin/magento module:enable WolfSellers_EnableDisableTfa` + - Apply database updates by running `php bin/magento setup:upgrade` + - Flush the cache by running `php bin/magento cache:flush` + +## Tested + +Tested in Magento 2.4.0, versions: + - Community + - Enterprise + - Cloud diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..04405c4 --- /dev/null +++ b/composer.json @@ -0,0 +1,26 @@ +{ + "name": "wolfsellers/module-enabledisabletfa", + "description": "Adds enable disable switch for the Two-factor Authorization", + "type": "magento2-module", + "license": "MIT", + "version": "1.0.0", + "authors": [ + { + "name": "Rus0", + "email": "andonid88@gmail.com", + "homepage": "https://wolfsellers.com" + } + ], + "minimum-stability": "dev", + "require": { + "magento/module-two-factor-auth": "^1.0.*" + }, + "autoload": { + "psr-4": { + "WolfSellers\\EnableDisableTfa\\": "" + }, + "files": [ + "registration.php" + ] + } +} diff --git a/etc/adminhtml/di.xml b/etc/adminhtml/di.xml new file mode 100644 index 0000000..3328195 --- /dev/null +++ b/etc/adminhtml/di.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml new file mode 100644 index 0000000..89eef72 --- /dev/null +++ b/etc/adminhtml/system.xml @@ -0,0 +1,16 @@ + + + +
+ security + Magento_TwoFactorAuth::config + + + + Enables/Disables Two-factor authorization + Magento\Config\Model\Config\Source\Yesno + + +
+
+
diff --git a/etc/config.xml b/etc/config.xml new file mode 100644 index 0000000..a13b72a --- /dev/null +++ b/etc/config.xml @@ -0,0 +1,10 @@ + + + + + + 0 + + + + diff --git a/etc/di.xml b/etc/di.xml new file mode 100644 index 0000000..01e7e22 --- /dev/null +++ b/etc/di.xml @@ -0,0 +1,4 @@ + + + + diff --git a/etc/module.xml b/etc/module.xml new file mode 100644 index 0000000..5dde498 --- /dev/null +++ b/etc/module.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/registration.php b/registration.php new file mode 100644 index 0000000..d28d6c2 --- /dev/null +++ b/registration.php @@ -0,0 +1,9 @@ +