mirror of https://github.com/itflow-org/itflow
2FA QR Codes
Move away from the Google Charts API for generating QR codes as this is currently broken and not a security best practice.
This commit is contained in:
parent
c02d6d4cf0
commit
8b1ba7028e
|
|
@ -36,8 +36,9 @@ require_once "header.php";
|
|||
|
||||
if (!empty($session_token)) {
|
||||
|
||||
//Generate QR Code based off the generated key
|
||||
print sprintf('<img src="%s"/>', TokenAuth6238::getBarCodeUrl($session_name, ' ', $session_token, $_SERVER['SERVER_NAME']));
|
||||
// Generate QR Code
|
||||
$data = "otpauth://totp/ITFlow:$session_email?secret=$session_token";
|
||||
print "<img src='plugins/barcode/barcode.php?f=png&s=qr&d=$data'>";
|
||||
|
||||
echo "<p class='text-secondary'>$session_token</p>";
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -58,14 +58,6 @@ class TokenAuth6238 {
|
|||
return $result;
|
||||
}
|
||||
|
||||
public static function getBarCodeUrl($username, $domain, $secretkey, $issuer) {
|
||||
$url = "https://chart.apis.google.com/chart";
|
||||
$url = $url."?chs=200x200&chld=M|0&cht=qr&chl=otpauth://totp/";
|
||||
$url = $url.$username . "@" . $domain . "%3Fsecret%3D" . $secretkey . '%26issuer%3D' . rawurlencode($issuer);
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
private static function oath_hotp ($key, $counter, $debug=false) {
|
||||
$result = "";
|
||||
$orgcounter = $counter;
|
||||
|
|
|
|||
|
|
@ -59,10 +59,12 @@ $remember_token_count = mysqli_num_rows($sql_remember_tokens);
|
|||
|
||||
if (!empty($session_token)) {
|
||||
|
||||
//Generate QR Code based off the generated key
|
||||
print sprintf('<img src="%s"/>', TokenAuth6238::getBarCodeUrl($session_name, ' ', $session_token, $_SERVER['SERVER_NAME']));
|
||||
// Generate QR Code
|
||||
$data = "otpauth://totp/ITFlow:$session_email?secret=$session_token";
|
||||
print "<img src='plugins/barcode/barcode.php?f=png&s=qr&d=$data'>";
|
||||
|
||||
echo "<p class='text-secondary'>$session_token</p>";
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue