tfa = $tfa; $this->session = $session; parent::__construct($context); } /** * Dispatch request * * @return \Magento\Framework\Controller\ResultInterface|ResponseInterface */ public function execute() { $this->_view->loadLayout(); $this->_view->renderLayout(); return $this->getResponse(); } /** * @return \Magento\User\Model\User|null */ private function getUser() { return $this->session->getUser(); } /** * Check if admin has permissions to visit related pages * * @return bool */ protected function _isAllowed() { $user = $this->getUser(); return $user && $this->tfa->getProviderIsAllowed($user->getId(), U2fKey::CODE) && !$this->tfa->getProvider(U2fKey::CODE)->isActive($user->getId()); } }