Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/magento/module-two-factor-auth/Block/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/module-two-factor-auth/Block/ConfigureLater.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\TwoFactorAuth\Block;

use Magento\Authorization\Model\UserContextInterface;
use Magento\Backend\Block\Template;
use Magento\Backend\Block\Template\Context;
use Magento\Framework\Data\Form\FormKey;
use Magento\Framework\Serialize\SerializerInterface;
use Magento\TwoFactorAuth\Api\TfaInterface;

/**
 * @api
 */
class ConfigureLater extends Template
{
    /**
     * @var TfaInterface
     */
    private $tfa;

    /**
     * @var SerializerInterface
     */
    private $serializer;

    /**
     * @var UserContextInterface
     */
    private $userContext;

    /**
     * ChangeProvider constructor.
     * @param Context $context
     * @param TfaInterface $tfa
     * @param SerializerInterface $serializer
     * @param FormKey $formKey
     * @param UserContextInterface $userContext
     * @param array $data
     */
    public function __construct(
        Context $context,
        TfaInterface $tfa,
        SerializerInterface $serializer,
        FormKey $formKey,
        UserContextInterface $userContext,
        array $data = []
    ) {
        parent::__construct($context, $data);
        $this->tfa = $tfa;
        $this->serializer = $serializer;
        $this->formKey = $formKey;
        $this->userContext = $userContext;
    }

    /**
     * @inheritDoc
     */
    protected function _toHtml()
    {
        $userId = $this->userContext->getUserId();
        $providers = $this->tfa->getUserProviders($userId);
        $toActivate = $this->tfa->getProvidersToActivate($userId);

        foreach ($toActivate as $toActivateProvider) {
            if ($toActivateProvider->getCode() === $this->getData('provider') && count($providers) > 1) {
                return parent::_toHtml();
            }
        }

        return '';
    }

    /**
     * Get a serialized string of post data for the configure later endpoint
     *
     * @return string
     */
    public function getPostData(): string
    {
        return $this->serializer->serialize(
            [
                'action' => $this->getUrl('tfa/tfa/configurelater'),
                'data' => [
                    'provider' => $this->getData('provider'),
                    'form_key' => $this->formKey->getFormKey()
                ]
            ]
        );
    }
}

Spamworldpro Mini