mirror of
https://github.com/itflow-org/itflow
synced 2026-07-23 00:40:45 +00:00
Replace Function key32gen() with generateTotpSecret()
This commit is contained in:
@@ -12,7 +12,7 @@ $company_logo = escapeHtml($row['company_logo']);
|
||||
|
||||
// Only generate the token once and store it in session:
|
||||
if (empty($_SESSION['mfa_token'])) {
|
||||
$token = key32gen();
|
||||
$token = generateTotpSecret();
|
||||
$_SESSION['mfa_token'] = $token;
|
||||
}
|
||||
$token = $_SESSION['mfa_token'];
|
||||
|
||||
@@ -3,7 +3,7 @@ require_once '../../libs/totp/totp.php';
|
||||
|
||||
// Only generate the token once and store it in session:
|
||||
if (empty($_SESSION['mfa_token'])) {
|
||||
$token = key32gen();
|
||||
$token = generateTotpSecret();
|
||||
$_SESSION['mfa_token'] = $token;
|
||||
}
|
||||
$token = $_SESSION['mfa_token'];
|
||||
|
||||
@@ -14,8 +14,8 @@ function randomString(int $length = 16): string {
|
||||
);
|
||||
}
|
||||
|
||||
// Used only for TOTP
|
||||
function key32gen() {
|
||||
// Generate a cryptographically secure 32-char base32 secret for TOTP
|
||||
function generateTotpSecret() {
|
||||
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
||||
$key = '';
|
||||
for ($i = 0; $i < 32; $i++) {
|
||||
|
||||
Reference in New Issue
Block a user