Save admin status in persistent token

This commit is contained in:
Ryan
2025-03-24 10:21:20 -04:00
committed by GitHub
parent 1d5c6a48b5
commit fc45767712
3 changed files with 5 additions and 5 deletions

View File

@@ -110,10 +110,11 @@ if ($userRole !== false) {
$persistentTokens = [];
}
}
// Save token along with username and expiry.
// Save token along with username, expiry, and admin status.
$persistentTokens[$token] = [
"username" => $username,
"expiry" => $expiry
"expiry" => $expiry,
"isAdmin" => ($userRole === "1")
];
$encryptedContent = encryptData(json_encode($persistentTokens, JSON_PRETTY_PRINT), $encryptionKey);
file_put_contents($persistentTokensFile, $encryptedContent, LOCK_EX);