fix: fix cannot enable token if set to unlimited time (close #230)

This commit is contained in:
JustSong
2023-07-02 14:47:06 +08:00
parent 0cea9e6a6f
commit f0c40a6cd0
2 changed files with 3 additions and 3 deletions

View File

@@ -180,10 +180,10 @@ func UpdateToken(c *gin.Context) {
return
}
if token.Status == common.TokenStatusEnabled {
if cleanToken.Status == common.TokenStatusExpired && cleanToken.ExpiredTime <= common.GetTimestamp() {
if cleanToken.Status == common.TokenStatusExpired && cleanToken.ExpiredTime <= common.GetTimestamp() && cleanToken.ExpiredTime != -1 {
c.JSON(http.StatusOK, gin.H{
"success": false,
"message": "令牌已过期,无法启用,请先修改令牌过期时间",
"message": "令牌已过期,无法启用,请先修改令牌过期时间,或者设置为永不过期",
})
return
}