From 65ec97c2ac2850ad0ad9de2a08aebca4e30fbf03 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 12 Jul 2016 17:46:08 +0200 Subject: [PATCH] show 2-fact-auth qrcode --- views/bootstrap/class.MyAccount.php | 59 ++++++++++++++++------------- 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/views/bootstrap/class.MyAccount.php b/views/bootstrap/class.MyAccount.php index bbc51152d..6417f8896 100644 --- a/views/bootstrap/class.MyAccount.php +++ b/views/bootstrap/class.MyAccount.php @@ -48,6 +48,7 @@ $(document).ready( function() { $user = $this->params['user']; $enableuserimage = $this->params['enableuserimage']; $passwordexpiration = $this->params['passwordexpiration']; + $enable2factauth = $this->params['enable2factauth']; $httproot = $this->params['httproot']; $quota = $this->params['quota']; @@ -75,20 +76,6 @@ $(document).ready( function() { echo "
\n"; } - 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('MyApp'); - - if($secret = $user->getSecret()) { - } else { - $secret = $tfa->createSecret(); - $user->setSecret($secret); - } print "\n"; print "\n"; print "\n"; @@ -137,19 +124,37 @@ $(document).ready( function() { \n"; print "\n"; - print "\n"; - print "\n"; - 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'); + + print "\n"; + print "\n"; + $secret = $user->getSecret(); + if(!$secret) { + print "\n"; + } else { + print "\n"; + } + print "\n"; + } } print "
".getMLText("name")." :
\n"; - echo getMLText('2_factor_auth'); - print "\n"; - echo ''; - echo '
'; - echo 'Code is: '.$code = $tfa->getCode($secret)."
"; - echo 'Secret: '.$secret."
"; - echo ''; - echo "
"; - print "
\n"; + echo getMLText('2_factor_auth'); + print "\n"; + echo ''.getMLText('setup_2_fact_auth').''; + print "\n"; + echo ''; + echo '
'; + echo 'Code is: '.$code = $tfa->getCode($secret)."
"; + echo 'Secret: '.$secret."
"; + echo ''; + echo "
"; + print "
\n";