add global disable variable

This commit is contained in:
Daniel Seifert 2018-10-21 20:54:58 +02:00
parent 19b3dc7881
commit 12294725bc
3 changed files with 124 additions and 117 deletions

View File

@ -78,7 +78,14 @@ class d3totp extends BaseModel
return $user;
}
/**
* @return bool
*/
public function isActive()
{
return false == Registry::getConfig()->getConfigParam('blDisableTotpGlobally')
&& $this->UserUseTotp();
}
/**
* @param $userId

View File

@ -39,7 +39,7 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
$totp->loadByUserId($auth);
if ($auth
&& $totp->UserUseTotp()
&& $totp->isActive()
&& false == Registry::getSession()->getVariable(d3totp::TOTP_SESSION_VARNAME)
&& Registry::getSession()->hasVariable('pwdTransmit')
) {
@ -91,7 +91,7 @@ class d3_totp_LoginController extends d3_totp_LoginController_parent
public function isNoTotpOrNoLogin($totp)
{
return false == Registry::getSession()->getVariable("auth")
|| false == $totp->UserUseTotp();
|| false == $totp->isActive();
}
/**

View File

@ -37,7 +37,7 @@ class d3_totp_utils extends d3_totp_utils_parent
$totp = oxNew(d3totp::class);
$totp->loadByUserId($userID);
if ($blAuth && $totp->UserUseTotp() && false === $totpAuth) {
if ($blAuth && $totp->isActive() && false === $totpAuth) {
Registry::getUtils()->redirect('index.php?cl=login', true, 302);
exit;
}