Skip to content

Commit

Permalink
Disable issue
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenix128 committed Sep 7, 2017
1 parent cf65edb commit f67de75
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Observer/BackendAuthUserLoginSuccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use MSP\TwoFactorAuth\Api\TfaInterface;
use MSP\TwoFactorAuth\Api\TrustedManagerInterface;

class BackendAuthUserLoginSuccess implements ObserverInterface
Expand All @@ -31,10 +32,17 @@ class BackendAuthUserLoginSuccess implements ObserverInterface
*/
private $trustedManager;

/**
* @var TfaInterface
*/
private $tfa;

public function __construct(
TfaInterface $tfa,
TrustedManagerInterface $trustedManager
) {
$this->trustedManager = $trustedManager;
$this->tfa = $tfa;
}

/**
Expand All @@ -43,6 +51,10 @@ public function __construct(
*/
public function execute(Observer $observer)
{
if (!$this->tfa->getIsEnabled()) {
return;
}

if ($this->trustedManager->isTrustedDevice()) {
$this->trustedManager->rotateTrustedDeviceToken();
}
Expand Down
4 changes: 4 additions & 0 deletions Observer/ControllerActionPredispatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ protected function getUser()
*/
public function execute(Observer $observer)
{
if (!$this->tfa->getIsEnabled()) {
return;
}

/** @var $controllerAction \Magento\Backend\App\AbstractAction */
$controllerAction = $observer->getEvent()->getControllerAction();
$fullActionName = $controllerAction->getRequest()->getFullActionName();
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="MSP_TwoFactorAuth" setup_version="2.0.8">
<module name="MSP_TwoFactorAuth" setup_version="2.0.9">
<sequence>
<module name="MSP_SecuritySuiteCommon"/>
<module name="Magento_User"/>
Expand Down

0 comments on commit f67de75

Please sign in to comment.