From d600b019a6da53147d56671100e8363fc0c97179 Mon Sep 17 00:00:00 2001 From: Linty Date: Wed, 29 Oct 2025 12:23:54 +0100 Subject: [PATCH] enable qrcode generation for totp secrets Uncommented and activated QR code generation in getQrCode(), allowing TOTP secrets to be encoded as base64 PNG images for easier setup in authenticator apps. --- include/totp.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/totp.class.php b/include/totp.class.php index fcab5a5a1..cab17128e 100644 --- a/include/totp.class.php +++ b/include/totp.class.php @@ -2,6 +2,7 @@ defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); require_once(PHPWG_ROOT_PATH . 'include/base32.class.php'); +require_once(PHPWG_ROOT_PATH . 'include/phpqrcode.php'); class PwgTOTP { @@ -62,14 +63,13 @@ class PwgTOTP */ public static function getQrCode($secret) { - // require_once(TF_REALPATH . 'include/phpqrcode.php'); - // $otp_url = self::getOtpAuthUrl($secret); + $otp_url = self::getOtpAuthUrl($secret); - // ob_start(); - // QRcode::png($otp_url); - // $qrcode_image = ob_get_clean(); - // $base64_qrcode = base64_encode($qrcode_image); - // return 'data:image/png;base64,' . $base64_qrcode; + ob_start(); + QRcode::png($otp_url); + $qrcode_image = ob_get_clean(); + $base64_qrcode = base64_encode($qrcode_image); + return 'data:image/png;base64,' . $base64_qrcode; } /**