From e1af3a8a27f933ef1ea462cac6cc748885ebcd55 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 2 Dec 2024 19:15:44 +0800 Subject: [PATCH] Translate captcha and password validation error messages to English for improved clarity --- helper/captcha.go | 10 +++++----- helper/password.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helper/captcha.go b/helper/captcha.go index d0e093889d..3092703aac 100644 --- a/helper/captcha.go +++ b/helper/captcha.go @@ -86,28 +86,28 @@ func CaptchaMake(option CaptchaOption) (string, string) { } -// CaptchaValidate 校验验证码 +// CaptchaValidate Validate the captcha func CaptchaValidate(id string, code string) bool { return captcha.VerifyString(id, code) } -// ProcessCaptchaValidate xiang.helper.CaptchaValidate 校验图形/音频验证码 +// ProcessCaptchaValidate xiang.helper.CaptchaValidate image/audio captcha func ProcessCaptchaValidate(process *process.Process) interface{} { process.ValidateArgNums(2) id := process.ArgsString(0) code := process.ArgsString(1) if code == "" { - exception.New("请输入验证码", 400).Throw() + exception.New("Please enter the captcha.", 400).Throw() return false } if !CaptchaValidate(id, code) { - exception.New("验证码不正确", 400).Throw() + exception.New("Invalid captcha.", 400).Throw() return false } return true } -// ProcessCaptcha xiang.helper.Captcha 校验图形/音频验证码 +// ProcessCaptcha xiang.helper.Captcha image/audio captcha func ProcessCaptcha(process *process.Process) interface{} { process.ValidateArgNums(1) option := CaptchaOption{ diff --git a/helper/password.go b/helper/password.go index 1d5b56c537..67d009e156 100644 --- a/helper/password.go +++ b/helper/password.go @@ -6,11 +6,11 @@ import ( "golang.org/x/crypto/bcrypt" ) -// PasswordValidate 校验密码 +// PasswordValidate Validate the password func PasswordValidate(password string, passwordHash string) bool { err := bcrypt.CompareHashAndPassword([]byte(passwordHash), []byte(password)) if err != nil { - exception.New("密码不正确", 400).Throw() + exception.New("Invalid password.", 400).Throw() return false } return true