bugfix TOTP, additional database entries needed: login_password_check_otp (hook), TOTPCheckLogin (hook_register)

This commit is contained in:
OpenXE 2024-08-11 12:46:41 +02:00
parent 94f3fb0261
commit 5ad57e2fc8
3 changed files with 132 additions and 133 deletions

View File

@ -270,7 +270,7 @@ class TOTPLoginService
$secret = $this->getTOTPSecret($userId); $secret = $this->getTOTPSecret($userId);
} }
$query = "otpauth://totp/{$label}?secret=" . $secret . '&issuer=Xentral&algorithm=SHA1&digits=6&period=30'; $query = "otpauth://totp/{$label}?secret=" . $secret . '&issuer=OpenXE&algorithm=SHA1&digits=6&period=30';
return $this->barcodeService->createQrCode($query); return $this->barcodeService->createQrCode($query);
} }

View File

@ -616,7 +616,7 @@ class TemplateParser {
} }
} }
if(count($this->VARARRAY)>0) if(!empty($this->VARARRAY))
foreach($this->VARARRAY as $key=>$value) foreach($this->VARARRAY as $key=>$value)
{ {
if($key!="") if($key!="")

View File

@ -104,7 +104,6 @@ class Totp
{ {
/** @var TOTPLoginService $totpLoginService */ /** @var TOTPLoginService $totpLoginService */
$totpLoginService = $this->app->Container->get('TOTPLoginService'); $totpLoginService = $this->app->Container->get('TOTPLoginService');
if(!$totpLoginService->isTOTPEnabled($userID)){ if(!$totpLoginService->isTOTPEnabled($userID)){
return; return;
} }
@ -120,7 +119,7 @@ class Totp
$secret = $tokenManager->generateBase32Secret(); $secret = $tokenManager->generateBase32Secret();
$label = 'Xentral' . ' | ' . $this->app->erp->GetFirmaName(); $label = 'OpenXE' . ':' . $this->app->User->Getname();
$qr = $totpLoginService->generatePairingQrCode($this->app->User->GetID(), $label, $secret); $qr = $totpLoginService->generatePairingQrCode($this->app->User->GetID(), $label, $secret);