token validity increase from 1 hour to 7 days

This commit is contained in:
2026-02-16 07:41:49 +01:00
parent b3be74e652
commit 02e9aa1ac4

View File

@ -105,7 +105,7 @@ class Users extends \TPsoft\DBmodel\DBmodel {
return password_verify($password, $password_hash);
}
public function generateToken(int $user_id, int $ttl_seconds = 3600): string {
public function generateToken(int $user_id, int $ttl_seconds = 604800): string {
if ($user_id <= 0) {
throw new \Exception('Invalid user_id');
}
@ -152,7 +152,7 @@ class Users extends \TPsoft\DBmodel\DBmodel {
if (!hash_equals($stored_token, $token)) {
return false;
}
$refresh_expires = date('Y-m-d H:i:s', time() + 3600);
$refresh_expires = date('Y-m-d H:i:s', time() + 604800); // 7 days
$updated = $this->user($user_id, array(
'token_expires' => $refresh_expires
));