* @link http://www.oxidmodule.com */ namespace D3\Totp\Modules\Core; use D3\Totp\Application\Model\d3totp; use Doctrine\DBAL\DBALException; use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; use OxidEsales\Eshop\Core\Registry; class d3_totp_utils extends d3_totp_utils_parent { /** * @return bool * @throws DBALException * @throws DatabaseConnectionException */ public function checkAccessRights() { $blAuth = parent::checkAccessRights(); $userID = Registry::getSession()->getVariable("auth"); $totpAuth = (bool) Registry::getSession()->getVariable(d3totp::TOTP_SESSION_VARNAME); /** @var d3totp $totp */ $totp = oxNew(d3totp::class); $totp->loadByUserId($userID); if ($blAuth && $totp->UserUseTotp() && false === $totpAuth) { Registry::getUtils()->redirect('index.php?cl=login', true, 302); exit; } return $blAuth; } }