fix: 令牌驗證額外添加是否為有效令牌

* 如果解密無效, 直接返回一個無效的令牌, 並加以判斷
This commit is contained in:
CrescentLeaf
2025-09-25 12:12:12 +08:00
parent 9cc3a2149e
commit 4fa3e16ab7
4 changed files with 16 additions and 8 deletions

View File

@@ -25,7 +25,7 @@ export default abstract class BaseApi {
}
checkToken(token: Token, deviceId: string) {
if (token.expired_time < Date.now()) return false
if (!User.findById(token.author)) return false
if (!token.author || !User.findById(token.author)) return false
if (deviceId != null)
if (token.device_id != deviceId)
return false