sun-pc hace 4 meses
padre
commit
c79c8827b5
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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
 		}