Skip to content

Commit

Permalink
Replace getAdminLog() with getLog()
Browse files Browse the repository at this point in the history
  • Loading branch information
Moc committed Feb 18, 2021
1 parent 143fb28 commit 200b1f1
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions twofactorauth_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public function init($data, $eventname)
// 2FA is NOT activated, return false to proceed with core login process.
if($this->tfa_debug)
{
e107::getAdminLog()->addDebug(__LINE__." ".__METHOD__.": 2FA is NOT activated for User ID ".$user_id);
e107::getAdminLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
e107::getLog()->addDebug(__LINE__." ".__METHOD__.": 2FA is NOT activated for User ID ".$user_id);
e107::getLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
}

return false;
Expand All @@ -56,9 +56,9 @@ public function init($data, $eventname)
// 2FA is enabled for this user. Continue verification process. Service page to enter TOTP digits, generated by user's authenthicator app.
if($this->tfa_debug)
{
e107::getAdminLog()->addDebug(__LINE__." ".__METHOD__.": 2FA is activated for User ID ".$user_id);
e107::getAdminLog()->addDebug(__LINE__." ".__METHOD__.": User will need to enter digits. Redirect to tfa/verify");
e107::getAdminLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
e107::getLog()->addDebug(__LINE__." ".__METHOD__.": 2FA is activated for User ID ".$user_id);
e107::getLog()->addDebug(__LINE__." ".__METHOD__.": User will need to enter digits. Redirect to tfa/verify");
e107::getLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
}

// Store some information in a session, so we can retrieve it again later
Expand Down Expand Up @@ -142,10 +142,10 @@ private function verifyTotp($user_id = USERID, $totp)

if($this->tfa_debug)
{
e107::getAdminLog()->addDebug(__LINE__." ".__METHOD__.": User ID: ".$user_id);
e107::getAdminLog()->addDebug(__LINE__." ".__METHOD__.": Secret Key: ".$secret_key);
e107::getAdminLog()->addDebug(__LINE__." ".__METHOD__.": Entered TOTP: ".$totp);
e107::getAdminLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
e107::getLog()->addDebug(__LINE__." ".__METHOD__.": User ID: ".$user_id);
e107::getLog()->addDebug(__LINE__." ".__METHOD__.": Secret Key: ".$secret_key);
e107::getLog()->addDebug(__LINE__." ".__METHOD__.": Entered TOTP: ".$totp);
e107::getLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
}

// Check if the entered TOTP is correct.
Expand All @@ -154,17 +154,17 @@ private function verifyTotp($user_id = USERID, $totp)
// TOTP is correct.
if($this->tfa_debug)
{
e107::getAdminLog()->addDebug(__LINE__." ".__METHOD__.": The TOTP code that was entered, is correct");
e107::getAdminLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
e107::getLog()->addDebug(__LINE__." ".__METHOD__.": The TOTP code that was entered, is correct");
e107::getLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
}
return true;
}
else
{
if($this->tfa_debug)
{
e107::getAdminLog()->addDebug(__LINE__." ".__METHOD__.": The TOTP code that was entered, is INCORRECT");
e107::getAdminLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
e107::getLog()->addDebug(__LINE__." ".__METHOD__.": The TOTP code that was entered, is INCORRECT");
e107::getLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
}
return false;
}
Expand All @@ -185,8 +185,8 @@ public function processLogin($user_id = USERID, $totp)

if($this->tfa_debug)
{
e107::getAdminLog()->addDebug(__LINE__." ".__METHOD__.": Session Previous page: ".$redirect_to);
e107::getAdminLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
e107::getLog()->addDebug(__LINE__." ".__METHOD__.": Session Previous page: ".$redirect_to);
e107::getLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
}

// Clear session data
Expand Down Expand Up @@ -232,9 +232,9 @@ public function processEnable($user_id = USERID, $secret_key, $totp)
{
if($this->tfa_debug)
{
e107::getAdminLog()->addDebug(__LINE__." ".__METHOD__.": Entered TOTP is incorrect: ".$totp);
e107::getAdminLog()->addDebug(__LINE__." ".__METHOD__.": Secret Key: ".$secret_key);
e107::getAdminLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
e107::getLog()->addDebug(__LINE__." ".__METHOD__.": Entered TOTP is incorrect: ".$totp);
e107::getLog()->addDebug(__LINE__." ".__METHOD__.": Secret Key: ".$secret_key);
e107::getLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
}

e107::getMessage()->addError(LAN_2FA_INCORRECT_TOTP);
Expand All @@ -243,17 +243,17 @@ public function processEnable($user_id = USERID, $secret_key, $totp)

if($this->tfa_debug)
{
e107::getAdminLog()->addDebug(__LINE__." ".__METHOD__.": Entered TOTP is correct. Continue adding secret key to EUF.");
e107::getAdminLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
e107::getLog()->addDebug(__LINE__." ".__METHOD__.": Entered TOTP is correct. Continue adding secret key to EUF.");
e107::getLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
}

if(!e107::getUserExt()->set($user_id, "user_plugin_twofactorauth_secret_key", $secret_key))
{
if($this->tfa_debug)
{
e107::getAdminLog()->addDebug(__LINE__." ".__METHOD__.": Could not add secret key to EUF");
e107::getAdminLog()->addDebug(e107::getDb()->getLastErrorText());
e107::getAdminLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
e107::getLog()->addDebug(__LINE__." ".__METHOD__.": Could not add secret key to EUF");
e107::getLog()->addDebug(e107::getDb()->getLastErrorText());
e107::getLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
}

e107::getMessage()->addError(LAN_2FA_DATABASE_ERROR);
Expand All @@ -262,8 +262,8 @@ public function processEnable($user_id = USERID, $secret_key, $totp)

if($this->tfa_debug)
{
e107::getAdminLog()->addDebug(__LINE__." ".__METHOD__.": Secret key has been added to the EUF");
e107::getAdminLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
e107::getLog()->addDebug(__LINE__." ".__METHOD__.": Secret key has been added to the EUF");
e107::getLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
}

return true;
Expand All @@ -287,8 +287,8 @@ public function processDisable($user_id = USERID, $totp)
{
if($this->tfa_debug)
{
e107::getAdminLog()->addDebug(__LINE__." ".__METHOD__.": Could not empty secret_key EUF field");
e107::getAdminLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
e107::getLog()->addDebug(__LINE__." ".__METHOD__.": Could not empty secret_key EUF field");
e107::getLog()->toFile('twofactorauth', 'TwoFactorAuth Debug Information', true);
}

e107::getMessage()->addError(LAN_2FA_DATABASE_ERROR);
Expand Down

0 comments on commit 200b1f1

Please sign in to comment.