sun-pc 4 달 전
부모
커밋
c79c8827b5
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/middleware/auth.go

+ 1 - 1
src/middleware/auth.go

@@ -39,7 +39,7 @@ func CasdoorAuthMiddleware() gin.HandlerFunc {
 			return
 		}
 		// 检查 token 是否过期
-		if claims.ExpiresAt.Compare(time.Now()) < 0 {
+		if time.Now().After(claims.ExpiresAt.Time) {
 			c.AbortWithStatusJSON(http.StatusUnauthorized, gin.H{"error": "Token has expired"})
 			return
 		}