(cp 9ac99be1d) fixes GHSA-9986-w7jf-33f6 and fixes GHSA-9986-w7jf-33f6

not include password.tpl from standard pages
This commit is contained in:
Linty
2025-10-17 16:24:25 +02:00
parent 2148a1cb22
commit 9d2565465e
11 changed files with 3749 additions and 36 deletions
+36
View File
@@ -2005,4 +2005,40 @@ SELECT COUNT(*)
}
return true;
}
/**
* Generate an user code for verification
*
* @since 16
* @return array [$secret, $code]
*/
function generate_user_code()
{
global $conf;
require_once(PHPWG_ROOT_PATH . 'include/totp.class.php');
$secret = PwgTOTP::generateSecret();
$code = PwgTOTP::generateCode($secret, min($conf['password_reset_code_duration'], 900)); // max 15 minutes
return array(
'secret' => $secret,
'code' => $code
);
}
/**
* Verify user code
*
* @since 16
* @param string $secret
* @param string $code
* @return bool
*/
function verify_user_code($secret, $code)
{
global $conf;
require_once(PHPWG_ROOT_PATH . 'include/totp.class.php');
return PwgTOTP::verifyCode($code, $secret, min($conf['password_reset_code_duration'], 900), 1);
}
?>