mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-05 16:50:29 +08:00
feat: make enableErrorMask work for corner cases by moving checks from controller to Translate() (#3996)
This commit is contained in:
@@ -54,13 +54,6 @@ func (c *ApiController) ResponseError(error string, data ...interface{}) {
|
|||||||
return
|
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}
|
resp := &Response{Status: "error", Msg: error}
|
||||||
c.ResponseJsonData(resp, data...)
|
c.ResponseJsonData(resp, data...)
|
||||||
}
|
}
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "password or code is incorrect, you have %d remaining chances",
|
"password or code is incorrect, you have %s remaining chances": "password or code is incorrect, you have %s remaining chances",
|
||||||
"unsupported password type: %s": "unsupported password type: %s"
|
"unsupported password type: %s": "unsupported password type: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Vaše oblast neumožňuje registraci pomocí telefonu",
|
"Your region is not allow to signup by phone": "Vaše oblast neumožňuje registraci pomocí telefonu",
|
||||||
"password or code is incorrect": "heslo nebo kód je nesprávné",
|
"password or code is incorrect": "heslo nebo kód je nesprávné",
|
||||||
"password or code is incorrect, you have %d remaining chances": "heslo nebo kód je nesprávné, máte %d zbývajících pokusů",
|
"password or code is incorrect, you have %s remaining chances": "heslo nebo kód je nesprávné, máte %s zbývajících pokusů",
|
||||||
"unsupported password type: %s": "nepodporovaný typ hesla: %s"
|
"unsupported password type: %s": "nepodporovaný typ hesla: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Ihre Region ist nicht berechtigt, sich telefonisch anzumelden",
|
"Your region is not allow to signup by phone": "Ihre Region ist nicht berechtigt, sich telefonisch anzumelden",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "Das Passwort oder der Code ist falsch. Du hast noch %d Versuche übrig",
|
"password or code is incorrect, you have %s remaining chances": "Das Passwort oder der Code ist falsch. Du hast noch %s Versuche übrig",
|
||||||
"unsupported password type: %s": "Nicht unterstützter Passworttyp: %s"
|
"unsupported password type: %s": "Nicht unterstützter Passworttyp: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "password or code is incorrect, you have %d remaining chances",
|
"password or code is incorrect, you have %s remaining chances": "password or code is incorrect, you have %s remaining chances",
|
||||||
"unsupported password type: %s": "unsupported password type: %s"
|
"unsupported password type: %s": "unsupported password type: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Tu región no está permitida para registrarse por teléfono",
|
"Your region is not allow to signup by phone": "Tu región no está permitida para registrarse por teléfono",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "Contraseña o código incorrecto, tienes %d intentos restantes",
|
"password or code is incorrect, you have %s remaining chances": "Contraseña o código incorrecto, tienes %s intentos restantes",
|
||||||
"unsupported password type: %s": "Tipo de contraseña no compatible: %s"
|
"unsupported password type: %s": "Tipo de contraseña no compatible: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "منطقه شما اجازه ثبتنام با تلفن را ندارد",
|
"Your region is not allow to signup by phone": "منطقه شما اجازه ثبتنام با تلفن را ندارد",
|
||||||
"password or code is incorrect": "رمز عبور یا کد نادرست است",
|
"password or code is incorrect": "رمز عبور یا کد نادرست است",
|
||||||
"password or code is incorrect, you have %d remaining chances": "رمز عبور یا کد نادرست است، شما %d فرصت باقیمانده دارید",
|
"password or code is incorrect, you have %s remaining chances": "رمز عبور یا کد نادرست است، شما %s فرصت باقیمانده دارید",
|
||||||
"unsupported password type: %s": "نوع رمز عبور پشتیبانی نشده: %s"
|
"unsupported password type: %s": "نوع رمز عبور پشتیبانی نشده: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "password or code is incorrect, you have %d remaining chances",
|
"password or code is incorrect, you have %s remaining chances": "password or code is incorrect, you have %s remaining chances",
|
||||||
"unsupported password type: %s": "unsupported password type: %s"
|
"unsupported password type: %s": "unsupported password type: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Votre région n'est pas autorisée à s'inscrire par téléphone",
|
"Your region is not allow to signup by phone": "Votre région n'est pas autorisée à s'inscrire par téléphone",
|
||||||
"password or code is incorrect": "mot de passe ou code invalide",
|
"password or code is incorrect": "mot de passe ou code invalide",
|
||||||
"password or code is incorrect, you have %d remaining chances": "Le mot de passe ou le code est incorrect, il vous reste %d chances",
|
"password or code is incorrect, you have %s remaining chances": "Le mot de passe ou le code est incorrect, il vous reste %s chances",
|
||||||
"unsupported password type: %s": "Type de mot de passe non pris en charge : %s"
|
"unsupported password type: %s": "Type de mot de passe non pris en charge : %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "password or code is incorrect, you have %d remaining chances",
|
"password or code is incorrect, you have %s remaining chances": "password or code is incorrect, you have %s remaining chances",
|
||||||
"unsupported password type: %s": "unsupported password type: %s"
|
"unsupported password type: %s": "unsupported password type: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Wilayah Anda tidak diizinkan untuk mendaftar melalui telepon",
|
"Your region is not allow to signup by phone": "Wilayah Anda tidak diizinkan untuk mendaftar melalui telepon",
|
||||||
"password or code is incorrect": "kata sandi atau kode salah",
|
"password or code is incorrect": "kata sandi atau kode salah",
|
||||||
"password or code is incorrect, you have %d remaining chances": "Sandi atau kode salah, Anda memiliki %d kesempatan tersisa",
|
"password or code is incorrect, you have %s remaining chances": "Sandi atau kode salah, Anda memiliki %s kesempatan tersisa",
|
||||||
"unsupported password type: %s": "jenis sandi tidak didukung: %s"
|
"unsupported password type: %s": "jenis sandi tidak didukung: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "password or code is incorrect, you have %d remaining chances",
|
"password or code is incorrect, you have %s remaining chances": "password or code is incorrect, you have %s remaining chances",
|
||||||
"unsupported password type: %s": "unsupported password type: %s"
|
"unsupported password type: %s": "unsupported password type: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "あなたの地域は電話でサインアップすることができません",
|
"Your region is not allow to signup by phone": "あなたの地域は電話でサインアップすることができません",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "パスワードまたはコードが間違っています。あと%d回の試行機会があります",
|
"password or code is incorrect, you have %s remaining chances": "パスワードまたはコードが間違っています。あと%s回の試行機会があります",
|
||||||
"unsupported password type: %s": "サポートされていないパスワードタイプ:%s"
|
"unsupported password type: %s": "サポートされていないパスワードタイプ:%s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "password or code is incorrect, you have %d remaining chances",
|
"password or code is incorrect, you have %s remaining chances": "password or code is incorrect, you have %s remaining chances",
|
||||||
"unsupported password type: %s": "unsupported password type: %s"
|
"unsupported password type: %s": "unsupported password type: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "당신의 지역은 전화로 가입할 수 없습니다",
|
"Your region is not allow to signup by phone": "당신의 지역은 전화로 가입할 수 없습니다",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "암호 또는 코드가 올바르지 않습니다. %d번의 기회가 남아 있습니다",
|
"password or code is incorrect, you have %s remaining chances": "암호 또는 코드가 올바르지 않습니다. %s번의 기회가 남아 있습니다",
|
||||||
"unsupported password type: %s": "지원되지 않는 암호 유형: %s"
|
"unsupported password type: %s": "지원되지 않는 암호 유형: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "password or code is incorrect, you have %d remaining chances",
|
"password or code is incorrect, you have %s remaining chances": "password or code is incorrect, you have %s remaining chances",
|
||||||
"unsupported password type: %s": "unsupported password type: %s"
|
"unsupported password type: %s": "unsupported password type: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "password or code is incorrect, you have %d remaining chances",
|
"password or code is incorrect, you have %s remaining chances": "password or code is incorrect, you have %s remaining chances",
|
||||||
"unsupported password type: %s": "unsupported password type: %s"
|
"unsupported password type: %s": "unsupported password type: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "password or code is incorrect, you have %d remaining chances",
|
"password or code is incorrect, you have %s remaining chances": "password or code is incorrect, you have %s remaining chances",
|
||||||
"unsupported password type: %s": "unsupported password type: %s"
|
"unsupported password type: %s": "unsupported password type: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
||||||
"password or code is incorrect": "senha ou código incorreto",
|
"password or code is incorrect": "senha ou código incorreto",
|
||||||
"password or code is incorrect, you have %d remaining chances": "password or code is incorrect, you have %d remaining chances",
|
"password or code is incorrect, you have %s remaining chances": "password or code is incorrect, you have %s remaining chances",
|
||||||
"unsupported password type: %s": "unsupported password type: %s"
|
"unsupported password type: %s": "unsupported password type: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Ваш регион не разрешает регистрацию по телефону",
|
"Your region is not allow to signup by phone": "Ваш регион не разрешает регистрацию по телефону",
|
||||||
"password or code is incorrect": "неправильный пароль или код",
|
"password or code is incorrect": "неправильный пароль или код",
|
||||||
"password or code is incorrect, you have %d remaining chances": "Неправильный пароль или код, у вас осталось %d попыток",
|
"password or code is incorrect, you have %s remaining chances": "Неправильный пароль или код, у вас осталось %s попыток",
|
||||||
"unsupported password type: %s": "неподдерживаемый тип пароля: %s"
|
"unsupported password type: %s": "неподдерживаемый тип пароля: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Váš región neumožňuje registráciu cez telefón",
|
"Your region is not allow to signup by phone": "Váš región neumožňuje registráciu cez telefón",
|
||||||
"password or code is incorrect": "heslo alebo kód je nesprávne",
|
"password or code is incorrect": "heslo alebo kód je nesprávne",
|
||||||
"password or code is incorrect, you have %d remaining chances": "heslo alebo kód je nesprávne, máte %d zostávajúcich pokusov",
|
"password or code is incorrect, you have %s remaining chances": "heslo alebo kód je nesprávne, máte %s zostávajúcich pokusov",
|
||||||
"unsupported password type: %s": "nepodporovaný typ hesla: %s"
|
"unsupported password type: %s": "nepodporovaný typ hesla: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "password or code is incorrect, you have %d remaining chances",
|
"password or code is incorrect, you have %s remaining chances": "password or code is incorrect, you have %s remaining chances",
|
||||||
"unsupported password type: %s": "unsupported password type: %s"
|
"unsupported password type: %s": "unsupported password type: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
||||||
"password or code is incorrect": "şifre veya kod hatalı",
|
"password or code is incorrect": "şifre veya kod hatalı",
|
||||||
"password or code is incorrect, you have %d remaining chances": "password or code is incorrect, you have %d remaining chances",
|
"password or code is incorrect, you have %s remaining chances": "password or code is incorrect, you have %s remaining chances",
|
||||||
"unsupported password type: %s": "unsupported password type: %s"
|
"unsupported password type: %s": "unsupported password type: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
"Your region is not allow to signup by phone": "Your region is not allow to signup by phone",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "password or code is incorrect, you have %d remaining chances",
|
"password or code is incorrect, you have %s remaining chances": "password or code is incorrect, you have %s remaining chances",
|
||||||
"unsupported password type: %s": "unsupported password type: %s"
|
"unsupported password type: %s": "unsupported password type: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"",
|
||||||
"Your region is not allow to signup by phone": "Vùng của bạn không được phép đăng ký bằng điện thoại",
|
"Your region is not allow to signup by phone": "Vùng của bạn không được phép đăng ký bằng điện thoại",
|
||||||
"password or code is incorrect": "password or code is incorrect",
|
"password or code is incorrect": "password or code is incorrect",
|
||||||
"password or code is incorrect, you have %d remaining chances": "Mật khẩu hoặc mã không chính xác, bạn còn %d lần cơ hội",
|
"password or code is incorrect, you have %s remaining chances": "Mật khẩu hoặc mã không chính xác, bạn còn %s lần cơ hội",
|
||||||
"unsupported password type: %s": "Loại mật khẩu không được hỗ trợ: %s"
|
"unsupported password type: %s": "Loại mật khẩu không được hỗ trợ: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
@@ -85,7 +85,7 @@
|
|||||||
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "您的密码已过期。请点击 \\\"忘记密码\\\" 以重置密码",
|
"Your password has expired. Please reset your password by clicking \\\"Forgot password\\\"": "您的密码已过期。请点击 \\\"忘记密码\\\" 以重置密码",
|
||||||
"Your region is not allow to signup by phone": "所在地区不支持手机号注册",
|
"Your region is not allow to signup by phone": "所在地区不支持手机号注册",
|
||||||
"password or code is incorrect": "密码错误",
|
"password or code is incorrect": "密码错误",
|
||||||
"password or code is incorrect, you have %d remaining chances": "密码错误,您还有 %d 次尝试的机会",
|
"password or code is incorrect, you have %s remaining chances": "密码错误,您还有 %s 次尝试的机会",
|
||||||
"unsupported password type: %s": "不支持的密码类型: %s"
|
"unsupported password type: %s": "不支持的密码类型: %s"
|
||||||
},
|
},
|
||||||
"enforcer": {
|
"enforcer": {
|
||||||
|
20
i18n/util.go
20
i18n/util.go
@@ -19,14 +19,21 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/casdoor/casdoor/conf"
|
||||||
"github.com/casdoor/casdoor/util"
|
"github.com/casdoor/casdoor/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var enableErrorMask = false
|
||||||
|
|
||||||
//go:embed locales/*/data.json
|
//go:embed locales/*/data.json
|
||||||
var f embed.FS
|
var f embed.FS
|
||||||
|
|
||||||
var langMap = make(map[string]map[string]map[string]string) // for example : langMap[en][account][Invalid information] = Invalid information
|
var langMap = make(map[string]map[string]map[string]string) // for example : langMap[en][account][Invalid information] = Invalid information
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
enableErrorMask = conf.GetConfigBool("enableErrorMask")
|
||||||
|
}
|
||||||
|
|
||||||
func getI18nFilePath(category string, language string) string {
|
func getI18nFilePath(category string, language string) string {
|
||||||
if category == "backend" {
|
if category == "backend" {
|
||||||
return fmt.Sprintf("../i18n/locales/%s/data.json", language)
|
return fmt.Sprintf("../i18n/locales/%s/data.json", language)
|
||||||
@@ -74,6 +81,15 @@ func applyData(data1 *I18nData, data2 *I18nData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Translate(language string, errorText string) string {
|
func Translate(language string, errorText string) string {
|
||||||
|
modified := false
|
||||||
|
if enableErrorMask {
|
||||||
|
if errorText == "general:The user: %s doesn't exist" ||
|
||||||
|
errorText == "check:password or code is incorrect, you have %s remaining chances" {
|
||||||
|
modified = true
|
||||||
|
errorText = "check:password or code is incorrect"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tokens := strings.SplitN(errorText, ":", 2)
|
tokens := strings.SplitN(errorText, ":", 2)
|
||||||
if !strings.Contains(errorText, ":") || len(tokens) != 2 {
|
if !strings.Contains(errorText, ":") || len(tokens) != 2 {
|
||||||
return fmt.Sprintf("Translate error: the error text doesn't contain \":\", errorText = %s", errorText)
|
return fmt.Sprintf("Translate error: the error text doesn't contain \":\", errorText = %s", errorText)
|
||||||
@@ -97,5 +113,9 @@ func Translate(language string, errorText string) string {
|
|||||||
if res == "" {
|
if res == "" {
|
||||||
res = tokens[1]
|
res = tokens[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if modified {
|
||||||
|
res += "%.s"
|
||||||
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,7 @@ package object
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/casdoor/casdoor/i18n"
|
"github.com/casdoor/casdoor/i18n"
|
||||||
@@ -100,7 +101,7 @@ func recordSigninErrorInfo(user *User, lang string, options ...bool) error {
|
|||||||
if leftChances == 0 && enableCaptcha {
|
if leftChances == 0 && enableCaptcha {
|
||||||
return fmt.Errorf(i18n.Translate(lang, "check:password or code is incorrect"))
|
return fmt.Errorf(i18n.Translate(lang, "check:password or code is incorrect"))
|
||||||
} else if leftChances >= 0 {
|
} else if leftChances >= 0 {
|
||||||
return fmt.Errorf(i18n.Translate(lang, "check:password or code is incorrect, you have %d remaining chances"), leftChances)
|
return fmt.Errorf(i18n.Translate(lang, "check:password or code is incorrect, you have %s remaining chances"), strconv.Itoa(leftChances))
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't show the chance error message if the user has no chance left
|
// don't show the chance error message if the user has no chance left
|
||||||
|
Reference in New Issue
Block a user