Translate captcha and password validation error messages to English for improved clarity
This commit is contained in:
parent
2c5b323d7d
commit
e1af3a8a27
2 changed files with 7 additions and 7 deletions
|
|
@ -86,28 +86,28 @@ func CaptchaMake(option CaptchaOption) (string, string) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CaptchaValidate 校验验证码
|
// CaptchaValidate Validate the captcha
|
||||||
func CaptchaValidate(id string, code string) bool {
|
func CaptchaValidate(id string, code string) bool {
|
||||||
return captcha.VerifyString(id, code)
|
return captcha.VerifyString(id, code)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProcessCaptchaValidate xiang.helper.CaptchaValidate 校验图形/音频验证码
|
// ProcessCaptchaValidate xiang.helper.CaptchaValidate image/audio captcha
|
||||||
func ProcessCaptchaValidate(process *process.Process) interface{} {
|
func ProcessCaptchaValidate(process *process.Process) interface{} {
|
||||||
process.ValidateArgNums(2)
|
process.ValidateArgNums(2)
|
||||||
id := process.ArgsString(0)
|
id := process.ArgsString(0)
|
||||||
code := process.ArgsString(1)
|
code := process.ArgsString(1)
|
||||||
if code == "" {
|
if code == "" {
|
||||||
exception.New("请输入验证码", 400).Throw()
|
exception.New("Please enter the captcha.", 400).Throw()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if !CaptchaValidate(id, code) {
|
if !CaptchaValidate(id, code) {
|
||||||
exception.New("验证码不正确", 400).Throw()
|
exception.New("Invalid captcha.", 400).Throw()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProcessCaptcha xiang.helper.Captcha 校验图形/音频验证码
|
// ProcessCaptcha xiang.helper.Captcha image/audio captcha
|
||||||
func ProcessCaptcha(process *process.Process) interface{} {
|
func ProcessCaptcha(process *process.Process) interface{} {
|
||||||
process.ValidateArgNums(1)
|
process.ValidateArgNums(1)
|
||||||
option := CaptchaOption{
|
option := CaptchaOption{
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,11 @@ import (
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
)
|
)
|
||||||
|
|
||||||
// PasswordValidate 校验密码
|
// PasswordValidate Validate the password
|
||||||
func PasswordValidate(password string, passwordHash string) bool {
|
func PasswordValidate(password string, passwordHash string) bool {
|
||||||
err := bcrypt.CompareHashAndPassword([]byte(passwordHash), []byte(password))
|
err := bcrypt.CompareHashAndPassword([]byte(passwordHash), []byte(password))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
exception.New("密码不正确", 400).Throw()
|
exception.New("Invalid password.", 400).Throw()
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue