|
|
@@ -38,7 +38,11 @@ func CheckApiAuth() gin.HandlerFunc {
|
|
|
return
|
|
|
}
|
|
|
nowAccessToken := strings.Fields(authHeader)[1]
|
|
|
- if nowAccessToken == "" || nowAccessToken != common.GetApiToken() {
|
|
|
+ if nowAccessToken == "" {
|
|
|
+ context.JSON(http.StatusUnauthorized, backend.ReplyCheckAuth{Message: "api_key_enabled == false or api_key is empty"})
|
|
|
+ context.Abort()
|
|
|
+ return
|
|
|
+ } else if nowAccessToken != common.GetApiToken() {
|
|
|
context.JSON(http.StatusUnauthorized, backend.ReplyCheckAuth{Message: "AccessToken Error"})
|
|
|
context.Abort()
|
|
|
return
|