1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-12 11:44:08 +02:00

[ticket/security/276] Centralise call for token expiration

SECURITY-276
This commit is contained in:
Marc Alexander
2024-05-09 11:51:59 +02:00
parent 7c661746cf
commit 1c1c981b17
8 changed files with 20 additions and 10 deletions

View File

@@ -57,7 +57,7 @@ class user extends \phpbb\session
* @param \phpbb\language\language $lang phpBB's Language loader
* @param string $datetime_class Class name of datetime class
*/
function __construct(\phpbb\language\language $lang, $datetime_class)
public function __construct(\phpbb\language\language $lang, $datetime_class)
{
global $phpbb_root_path;
@@ -78,6 +78,16 @@ class user extends \phpbb\session
return $this->is_setup_flag;
}
/**
* Get expiration time for user tokens, e.g. activation or reset password tokens
*
* @return int Expiration for user tokens
*/
public static function get_token_expiration(): int
{
return strtotime('+1 day') ?: 0;
}
/**
* Magic getter for BC compatibility
*