ltsecurityinc安防产品在线商城代码
This commit is contained in:
+55
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Admin Actions Log for Magento 2
|
||||
*/
|
||||
|
||||
namespace Amasty\AdminActionsLog\Plugin\TwoFactorAuth\Model;
|
||||
|
||||
use Amasty\AdminActionsLog\Api\Logging\MetadataInterface;
|
||||
use Amasty\AdminActionsLog\Api\Logging\MetadataInterfaceFactory;
|
||||
use Amasty\AdminActionsLog\Logging;
|
||||
use Magento\Framework\App\RequestInterface;
|
||||
use Magento\TwoFactorAuth\Api\TfaSessionInterface;
|
||||
|
||||
class TfaSessionPlugin
|
||||
{
|
||||
/**
|
||||
* @var RequestInterface
|
||||
*/
|
||||
private $request;
|
||||
|
||||
/**
|
||||
* @var Logging\ActionFactory
|
||||
*/
|
||||
private $actionFactory;
|
||||
|
||||
/**
|
||||
* @var MetadataInterfaceFactory
|
||||
*/
|
||||
private $metadataFactory;
|
||||
|
||||
public function __construct(
|
||||
RequestInterface $request,
|
||||
Logging\ActionFactory $actionFactory,
|
||||
MetadataInterfaceFactory $metadataFactory
|
||||
) {
|
||||
$this->request = $request;
|
||||
$this->actionFactory = $actionFactory;
|
||||
$this->metadataFactory = $metadataFactory;
|
||||
}
|
||||
|
||||
public function afterGrantAccess(TfaSessionInterface $subject)
|
||||
{
|
||||
$metadata = $this->metadataFactory->create([
|
||||
'request' => $this->request,
|
||||
'eventName' => MetadataInterface::EVENT_LOGIN
|
||||
]);
|
||||
$actionHandler = $this->actionFactory->create($metadata);
|
||||
$actionHandler->execute();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user