feat: make enableErrorMask work for corner cases by moving checks from controller to Translate() (#3996)

This commit is contained in:
DacongDA
2025-07-25 00:39:01 +08:00
committed by GitHub
parent 0495d17a07
commit 5f702ca418
28 changed files with 47 additions and 33 deletions

View File

@@ -54,13 +54,6 @@ func (c *ApiController) ResponseError(error string, data ...interface{}) {
return
}
enableErrorMask := conf.GetConfigBool("enableErrorMask")
if enableErrorMask {
if strings.HasPrefix(error, "The user: ") && strings.HasSuffix(error, " doesn't exist") || strings.HasPrefix(error, "用户: ") && strings.HasSuffix(error, "不存在") {
error = c.T("check:password or code is incorrect")
}
}
resp := &Response{Status: "error", Msg: error}
c.ResponseJsonData(resp, data...)
}