* @link http://www.oxidmodule.com */ namespace D3\Webauthn\Modules\Application\Controller; use D3\Webauthn\Application\Model\d3webauthn; use D3\Webauthn\Application\Model\WebauthnConf; use Doctrine\DBAL\DBALException; use OxidEsales\Eshop\Application\Model\User; use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException; use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Session; trait d3_webauthn_getUserTrait { /** * @return bool|object|User * @throws DatabaseConnectionException * @throws DBALException */ public function getUser() { $oUser = parent::getUser(); if ($oUser && $oUser->getId()) { $webauthn = $this->d3GetWebauthnpObject(); $webauthn->loadByUserId($oUser->getId()); if ($webauthn->isActive() && false == $this->d3GetSessionObject()->getVariable(WebauthnConf::WEBAUTHN_SESSION_AUTH) ) { return false; } } return $oUser; } /** * @return d3webauthn */ public function d3GetWebauthnpObject() { return oxNew(d3webauthn::class); } /** * @return Session */ public function d3GetSessionObject() { return Registry::getSession(); } }