mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-18 02:59:27 +00:00
show 2-fact-auth qrcode
This commit is contained in:
parent
4230df3c88
commit
65ec97c2ac
|
@ -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 "<div class=\"span12\">\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 "<table class=\"table-condensed\">\n";
|
||||
print "<tr>\n";
|
||||
print "<td>".getMLText("name")." : </td>\n";
|
||||
|
@ -137,19 +124,37 @@ $(document).ready( function() {
|
|||
<?php
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
print "<tr>\n";
|
||||
print "<td>\n";
|
||||
echo getMLText('2_factor_auth');
|
||||
print "</td>\n";
|
||||
print "<td>\n";
|
||||
echo '<button class="btn btn-default" id="toggleqrcode">'.getMLText('toggle_qrcode').'</button>';
|
||||
echo '<div id="qrcode">';
|
||||
echo 'Code is: '.$code = $tfa->getCode($secret)."<br />";
|
||||
echo 'Secret: '.$secret."<br />";
|
||||
echo '<img src="' . $tfa->getQRCodeImageAsDataUri('My label', $secret) . '">';
|
||||
echo "</div>";
|
||||
print "</td>\n";
|
||||
print "</tr>\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 "<tr>\n";
|
||||
print "<td>\n";
|
||||
echo getMLText('2_factor_auth');
|
||||
print "</td>\n";
|
||||
$secret = $user->getSecret();
|
||||
if(!$secret) {
|
||||
print "<td>\n";
|
||||
echo '<a class="btn btn-default" href="../out/out.Setup2Factor.php">'.getMLText('setup_2_fact_auth').'</a>';
|
||||
print "</td>\n";
|
||||
} else {
|
||||
print "<td>\n";
|
||||
echo '<button class="btn btn-default" id="toggleqrcode">'.getMLText('toggle_qrcode').'</button>';
|
||||
echo '<div id="qrcode">';
|
||||
echo 'Code is: '.$code = $tfa->getCode($secret)."<br />";
|
||||
echo 'Secret: '.$secret."<br />";
|
||||
echo '<img src="' . $tfa->getQRCodeImageAsDataUri('My label', $secret) . '">';
|
||||
echo "</div>";
|
||||
print "</td>\n";
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user