From 085ffee9719ef6b8bde73639d9c844fc0f3df42e Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 16 Dec 2025 15:25:11 +0100 Subject: [PATCH] replace old code to show qrcode and secret of 2-factor auth --- views/bootstrap/class.MyAccount.php | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/views/bootstrap/class.MyAccount.php b/views/bootstrap/class.MyAccount.php index ead18977f..bbdd9b037 100644 --- a/views/bootstrap/class.MyAccount.php +++ b/views/bootstrap/class.MyAccount.php @@ -14,9 +14,12 @@ */ /** - * Include parent class + * Include classes for 2-factor authentication */ -//require_once("class.Bootstrap.php"); +require "vendor/autoload.php"; + +use RobThree\Auth\TwoFactorAuth; +use RobThree\Auth\Providers\Qr\BaconQrCodeProvider; /** * Class which outputs the html page for MyAccount view @@ -125,34 +128,25 @@ $(document).ready( function() { print "\n"; print "\n"; if($enable2factauth) { - require "vendor/robthree/twofactorauth/lib/Providers/Qr/IQRCodeProvider.php"; - require "vendor/robthree/twofactorauth/lib/Providers/Qr/BaseHTTPQRCodeProvider.php"; - require "vendor/robthree/twofactorauth/lib/Providers/Qr/GoogleQRCodeProvider.php"; - require "vendor/robthree/twofactorauth/lib/Providers/Rng/IRNGProvider.php"; - require "vendor/robthree/twofactorauth/lib/Providers/Rng/MCryptRNGProvider.php"; - require "vendor/robthree/twofactorauth/lib/TwoFactorAuthException.php"; - require "vendor/robthree/twofactorauth/lib/TwoFactorAuth.php"; - $tfa = new \RobThree\Auth\TwoFactorAuth('SeedDMS'); + $tfa = new TwoFactorAuth(new BaconQrCodeProvider()); print "\n"; print "\n"; echo getMLText('2_factor_auth'); print "\n"; + print "\n"; $secret = $user->getSecret(); if(!$secret) { - print "\n"; - echo ''.getMLText('setup_2_fact_auth').''; - print "\n"; + echo ''.getMLText('setup_2_fact_auth').''; } else { - print "\n"; - echo ''; + echo ''; echo '
'; echo 'Code is: '.$code = $tfa->getCode($secret)."
"; echo 'Secret: '.$secret."
"; - echo ''; + echo ''; echo "
"; - print "\n"; } + print "\n"; print "\n"; } } @@ -165,4 +159,3 @@ $(document).ready( function() { $this->htmlEndPage(); } /* }}} */ } -?>