pageFactory = $pageFactory; $this->session = $session; $this->tfa = $tfa; $this->userConfigManager = $userConfigManager; $this->registry = $registry; } /** * Get current user * @return \Magento\User\Model\User|null */ private function getUser() { return $this->session->getUser(); } /** * Get verify information * @return verify payload * @throws \Magento\Framework\Exception\NoSuchEntityException */ private function getVerifyInformation() { $providerConfig = $this->userConfigManager->getProviderConfig($this->getUser()->getId(), Authy::CODE); if (!isset($providerConfig['verify'])) { return null; } return $providerConfig['verify']; } /** * @inheritdoc */ public function execute() { $verifyInfo = $this->getVerifyInformation(); $this->registry->register('msp_tfa_authy_verify', $verifyInfo); return $this->pageFactory->create(); } /** * @inheritdoc */ protected function _isAllowed() { $user = $this->getUser(); return $user && $this->tfa->getProviderIsAllowed($user->getId(), Authy::CODE) && $this->getVerifyInformation() && !$this->tfa->getProvider(Authy::CODE)->isActive($user->getId()); } }