chore: code clean

This commit is contained in:
Steven
2023-07-17 21:14:40 +08:00
parent b2ce071ef0
commit 21ff8ba797
3 changed files with 26 additions and 32 deletions

View File

@ -88,6 +88,7 @@ func JWTMiddleware(server *APIV1Service, next echo.HandlerFunc, secret string) e
if util.HasPrefixes(path, "/s/*") && method == http.MethodGet {
return next(c)
}
auth.RemoveTokensAndCookies(c)
return echo.NewHTTPError(http.StatusUnauthorized, "Missing access token")
}
@ -116,6 +117,7 @@ func JWTMiddleware(server *APIV1Service, next echo.HandlerFunc, secret string) e
generateToken = true
}
} else {
auth.RemoveTokensAndCookies(c)
return echo.NewHTTPError(http.StatusUnauthorized, errors.Wrap(err, "Invalid or expired access token"))
}
}