oxtotp/src/Modules/Application/Model/d3_totp_user.php

63 lines
1.6 KiB
PHP
Raw Normal View History

2018-10-23 21:50:36 +02:00
<?php
/**
2022-09-26 15:22:26 +02:00
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
2018-10-23 21:50:36 +02:00
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
2022-09-26 15:22:26 +02:00
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
2018-10-23 21:50:36 +02:00
*/
2022-09-28 00:08:36 +02:00
declare(strict_types=1);
2018-10-23 21:50:36 +02:00
namespace D3\Totp\Modules\Application\Model;
use D3\Totp\Application\Model\d3totp;
2022-11-10 00:00:50 +01:00
use D3\Totp\Application\Model\d3totp_conf;
2018-10-23 21:50:36 +02:00
use OxidEsales\Eshop\Core\Registry;
2019-08-08 23:50:09 +02:00
use OxidEsales\Eshop\Core\Session;
2018-10-23 21:50:36 +02:00
class d3_totp_user extends d3_totp_user_parent
{
public function logout()
{
$return = parent::logout();
2022-11-10 00:00:50 +01:00
$this->d3TotpGetSession()->deleteVariable(d3totp_conf::SESSION_AUTH);
$this->d3TotpGetSession()->deleteVariable(d3totp_conf::SESSION_CURRENTUSER);
2018-10-23 21:50:36 +02:00
return $return;
}
/**
* @return d3totp
*/
public function d3getTotp()
{
2019-08-11 00:33:59 +02:00
return oxNew(d3totp::class);
}
2019-08-08 23:50:09 +02:00
/**
* @return Session
*/
2022-11-10 00:00:50 +01:00
public function d3TotpGetSession()
2019-08-08 23:50:09 +02:00
{
return Registry::getSession();
}
/**
* @return string|null
*/
public function d3TotpGetCurrentUser(): ?string
{
return $this->d3TotpGetSession()->hasVariable(d3totp_conf::SESSION_CURRENTUSER) ?
$this->d3TotpGetSession()->getVariable(d3totp_conf::SESSION_CURRENTUSER) :
2022-11-12 14:36:17 +01:00
($this->isAdmin() ?
$this->d3TotpGetSession()->getVariable(d3totp_conf::OXID_ADMIN_AUTH) :
$this->d3TotpGetSession()->getVariable(d3totp_conf::OXID_FRONTEND_AUTH));
}
2022-09-30 21:06:30 +02:00
}