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'];
|
$user = $this->params['user'];
|
||||||
$enableuserimage = $this->params['enableuserimage'];
|
$enableuserimage = $this->params['enableuserimage'];
|
||||||
$passwordexpiration = $this->params['passwordexpiration'];
|
$passwordexpiration = $this->params['passwordexpiration'];
|
||||||
|
$enable2factauth = $this->params['enable2factauth'];
|
||||||
$httproot = $this->params['httproot'];
|
$httproot = $this->params['httproot'];
|
||||||
$quota = $this->params['quota'];
|
$quota = $this->params['quota'];
|
||||||
|
|
||||||
|
@ -75,20 +76,6 @@ $(document).ready( function() {
|
||||||
echo "<div class=\"span12\">\n";
|
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 "<table class=\"table-condensed\">\n";
|
||||||
print "<tr>\n";
|
print "<tr>\n";
|
||||||
print "<td>".getMLText("name")." : </td>\n";
|
print "<td>".getMLText("name")." : </td>\n";
|
||||||
|
@ -137,19 +124,37 @@ $(document).ready( function() {
|
||||||
<?php
|
<?php
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
print "<tr>\n";
|
if($enable2factauth) {
|
||||||
print "<td>\n";
|
require "vendor/robthree/twofactorauth/lib/Providers/Qr/IQRCodeProvider.php";
|
||||||
echo getMLText('2_factor_auth');
|
require "vendor/robthree/twofactorauth/lib/Providers/Qr/BaseHTTPQRCodeProvider.php";
|
||||||
print "</td>\n";
|
require "vendor/robthree/twofactorauth/lib/Providers/Qr/GoogleQRCodeProvider.php";
|
||||||
print "<td>\n";
|
require "vendor/robthree/twofactorauth/lib/Providers/Rng/IRNGProvider.php";
|
||||||
echo '<button class="btn btn-default" id="toggleqrcode">'.getMLText('toggle_qrcode').'</button>';
|
require "vendor/robthree/twofactorauth/lib/Providers/Rng/MCryptRNGProvider.php";
|
||||||
echo '<div id="qrcode">';
|
require "vendor/robthree/twofactorauth/lib/TwoFactorAuthException.php";
|
||||||
echo 'Code is: '.$code = $tfa->getCode($secret)."<br />";
|
require "vendor/robthree/twofactorauth/lib/TwoFactorAuth.php";
|
||||||
echo 'Secret: '.$secret."<br />";
|
$tfa = new \RobThree\Auth\TwoFactorAuth('SeedDMS');
|
||||||
echo '<img src="' . $tfa->getQRCodeImageAsDataUri('My label', $secret) . '">';
|
|
||||||
echo "</div>";
|
print "<tr>\n";
|
||||||
print "</td>\n";
|
print "<td>\n";
|
||||||
print "</tr>\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";
|
print "</table>\n";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user