style: 响应信息改英文
This commit is contained in:
@@ -237,13 +237,13 @@ func LoginOMC(w http.ResponseWriter, r *http.Request) {
|
||||
err := ctx.ShouldBindJSON(r, &body)
|
||||
if err != nil {
|
||||
log.Error("Invalid Json Format")
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "参数错误"))
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
// response 400-5
|
||||
if body.Username == "" || body.Password == "" {
|
||||
log.Error("Wrong parameter value")
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "参数错误"))
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "parameter error"))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -257,20 +257,20 @@ func LoginOMC(w http.ResponseWriter, r *http.Request) {
|
||||
if captchaEnabled {
|
||||
if body.Code == "" || body.UUID == "" {
|
||||
log.Error("Authentication failed, mismatch captcha")
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "验证码信息错误"))
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "Verification code information error"))
|
||||
return
|
||||
}
|
||||
verifyKey := cachekey.CAPTCHA_CODE_KEY + body.UUID
|
||||
captcha, ok := cache.GetLocalTTL(verifyKey)
|
||||
if captcha == nil || !ok {
|
||||
log.Error("Authentication failed, captcha emtry")
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "验证码已失效"))
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "The verification code has expired"))
|
||||
return
|
||||
}
|
||||
cache.DeleteLocalTTL(verifyKey)
|
||||
if captcha.(string) != body.Code {
|
||||
log.Error("Authentication failed, not match captcha")
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "验证码错误"))
|
||||
ctx.JSON(w, 400, result.CodeMsg(400, "Verification code error"))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user