From 6fb3e2cd7f52b0b44fb57403d5199d7029223da0 Mon Sep 17 00:00:00 2001 From: Gucheng Wang Date: Fri, 6 Jan 2023 19:49:00 +0800 Subject: [PATCH] Remove check_util i18n words --- i18n/locales/de/data.json | 7 +--- i18n/locales/en/data.json | 7 +--- i18n/locales/es/data.json | 7 +--- i18n/locales/fr/data.json | 7 +--- i18n/locales/ja/data.json | 7 +--- i18n/locales/ko/data.json | 7 +--- i18n/locales/ru/data.json | 7 +--- i18n/locales/zh/data.json | 79 +++++++++++++++++++-------------------- object/check.go | 6 +-- object/check_util.go | 4 +- 10 files changed, 57 insertions(+), 81 deletions(-) diff --git a/i18n/locales/de/data.json b/i18n/locales/de/data.json index 8f8376cb..2560589c 100644 --- a/i18n/locales/de/data.json +++ b/i18n/locales/de/data.json @@ -67,12 +67,9 @@ "Username is too long (maximum is 39 characters).": "Username is too long (maximum is 39 characters).", "Username must have at least 2 characters": "Username must have at least 2 characters", "You don't have the permission to do this": "You don't have the permission to do this", - "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again": "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again", - "unsupported password type: %s": "unsupported password type: %s" - }, - "check_util": { "You have entered the wrong password or code too many times, please wait for %d minutes and try again": "You have entered the wrong password or code too many times, please wait for %d minutes and try again", - "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 %d remaining chances": "password or code is incorrect, you have %d remaining chances", + "unsupported password type: %s": "unsupported password type: %s" }, "enforcer": { "Please sign in first": "Please sign in first" diff --git a/i18n/locales/en/data.json b/i18n/locales/en/data.json index 8f8376cb..2560589c 100644 --- a/i18n/locales/en/data.json +++ b/i18n/locales/en/data.json @@ -67,12 +67,9 @@ "Username is too long (maximum is 39 characters).": "Username is too long (maximum is 39 characters).", "Username must have at least 2 characters": "Username must have at least 2 characters", "You don't have the permission to do this": "You don't have the permission to do this", - "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again": "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again", - "unsupported password type: %s": "unsupported password type: %s" - }, - "check_util": { "You have entered the wrong password or code too many times, please wait for %d minutes and try again": "You have entered the wrong password or code too many times, please wait for %d minutes and try again", - "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 %d remaining chances": "password or code is incorrect, you have %d remaining chances", + "unsupported password type: %s": "unsupported password type: %s" }, "enforcer": { "Please sign in first": "Please sign in first" diff --git a/i18n/locales/es/data.json b/i18n/locales/es/data.json index 8f8376cb..2560589c 100644 --- a/i18n/locales/es/data.json +++ b/i18n/locales/es/data.json @@ -67,12 +67,9 @@ "Username is too long (maximum is 39 characters).": "Username is too long (maximum is 39 characters).", "Username must have at least 2 characters": "Username must have at least 2 characters", "You don't have the permission to do this": "You don't have the permission to do this", - "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again": "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again", - "unsupported password type: %s": "unsupported password type: %s" - }, - "check_util": { "You have entered the wrong password or code too many times, please wait for %d minutes and try again": "You have entered the wrong password or code too many times, please wait for %d minutes and try again", - "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 %d remaining chances": "password or code is incorrect, you have %d remaining chances", + "unsupported password type: %s": "unsupported password type: %s" }, "enforcer": { "Please sign in first": "Please sign in first" diff --git a/i18n/locales/fr/data.json b/i18n/locales/fr/data.json index 8f8376cb..2560589c 100644 --- a/i18n/locales/fr/data.json +++ b/i18n/locales/fr/data.json @@ -67,12 +67,9 @@ "Username is too long (maximum is 39 characters).": "Username is too long (maximum is 39 characters).", "Username must have at least 2 characters": "Username must have at least 2 characters", "You don't have the permission to do this": "You don't have the permission to do this", - "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again": "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again", - "unsupported password type: %s": "unsupported password type: %s" - }, - "check_util": { "You have entered the wrong password or code too many times, please wait for %d minutes and try again": "You have entered the wrong password or code too many times, please wait for %d minutes and try again", - "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 %d remaining chances": "password or code is incorrect, you have %d remaining chances", + "unsupported password type: %s": "unsupported password type: %s" }, "enforcer": { "Please sign in first": "Please sign in first" diff --git a/i18n/locales/ja/data.json b/i18n/locales/ja/data.json index 8f8376cb..2560589c 100644 --- a/i18n/locales/ja/data.json +++ b/i18n/locales/ja/data.json @@ -67,12 +67,9 @@ "Username is too long (maximum is 39 characters).": "Username is too long (maximum is 39 characters).", "Username must have at least 2 characters": "Username must have at least 2 characters", "You don't have the permission to do this": "You don't have the permission to do this", - "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again": "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again", - "unsupported password type: %s": "unsupported password type: %s" - }, - "check_util": { "You have entered the wrong password or code too many times, please wait for %d minutes and try again": "You have entered the wrong password or code too many times, please wait for %d minutes and try again", - "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 %d remaining chances": "password or code is incorrect, you have %d remaining chances", + "unsupported password type: %s": "unsupported password type: %s" }, "enforcer": { "Please sign in first": "Please sign in first" diff --git a/i18n/locales/ko/data.json b/i18n/locales/ko/data.json index 8f8376cb..2560589c 100644 --- a/i18n/locales/ko/data.json +++ b/i18n/locales/ko/data.json @@ -67,12 +67,9 @@ "Username is too long (maximum is 39 characters).": "Username is too long (maximum is 39 characters).", "Username must have at least 2 characters": "Username must have at least 2 characters", "You don't have the permission to do this": "You don't have the permission to do this", - "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again": "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again", - "unsupported password type: %s": "unsupported password type: %s" - }, - "check_util": { "You have entered the wrong password or code too many times, please wait for %d minutes and try again": "You have entered the wrong password or code too many times, please wait for %d minutes and try again", - "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 %d remaining chances": "password or code is incorrect, you have %d remaining chances", + "unsupported password type: %s": "unsupported password type: %s" }, "enforcer": { "Please sign in first": "Please sign in first" diff --git a/i18n/locales/ru/data.json b/i18n/locales/ru/data.json index 8f8376cb..2560589c 100644 --- a/i18n/locales/ru/data.json +++ b/i18n/locales/ru/data.json @@ -67,12 +67,9 @@ "Username is too long (maximum is 39 characters).": "Username is too long (maximum is 39 characters).", "Username must have at least 2 characters": "Username must have at least 2 characters", "You don't have the permission to do this": "You don't have the permission to do this", - "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again": "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again", - "unsupported password type: %s": "unsupported password type: %s" - }, - "check_util": { "You have entered the wrong password or code too many times, please wait for %d minutes and try again": "You have entered the wrong password or code too many times, please wait for %d minutes and try again", - "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 %d remaining chances": "password or code is incorrect, you have %d remaining chances", + "unsupported password type: %s": "unsupported password type: %s" }, "enforcer": { "Please sign in first": "Please sign in first" diff --git a/i18n/locales/zh/data.json b/i18n/locales/zh/data.json index c71167e1..4b3efd3f 100644 --- a/i18n/locales/zh/data.json +++ b/i18n/locales/zh/data.json @@ -3,34 +3,34 @@ "Email: %s": "邮件: %s", "Get init score failed, error: %w": "初始化分数失败: %w", "Invalid information": "无效信息", - "Phone: %s": "电话: %s", - "Please sign out first before signing up": "请在登陆前登出", + "Phone: %s": "手机号: %s", + "Please sign out first before signing up": "请在登录前登出", "The application does not allow to sign up new account": "该应用不允许注册新账户" }, "application": { - "Parameter organization is missing": "Organization参数丢失", + "Parameter organization is missing": "organization参数丢失", "The user: %s doesn't exist": "用户不存在: %s" }, "auth": { - "%s No phone prefix": "%s 无此电话前缀", + "%s No phone prefix": "%s 无此手机号前缀", "Challenge method should be S256": "Challenge 方法应该为 S256", "Failed to create user, user information is invalid: %s": "创建用户失败,用户信息无效: %s", "Failed to login in: %s": "无法登录: %s", "Get init score failed, error: %w": "初始化分数失败: %w", "Invalid token": "无效token", - "Please sign out first before signing in": "请在登陆前登出", - "State expected: %s, but got: %s": "期望状态位: %s, 实际状态为: %s", + "Please sign out first before signing in": "请在登录前登出", + "State expected: %s, but got: %s": "期望状态为: %s, 实际状态为: %s", "The account does not exist": "账户不存在", "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account via %%s, please use another way to sign up": "提供商账户: %s 与用户名: %s (%s) 不存在且 不允许通过 %s 注册新账户, 请使用其他方式注册", "The account for provider: %s and username: %s (%s) does not exist and is not allowed to sign up as new account, please contact your IT support": "提供商账户: %s 与用户名: %s (%s) 不存在且 不允许注册新账户, 请联系IT支持", "The account for provider: %s and username: %s (%s) is already linked to another account: %s (%s)": "提供商账户: %s 与用户名: %s (%s) 已经与其他账户绑定: %s (%s)", "The application: %s does not exist": "应用 %s 不存在", - "The login method: login with password is not enabled for the application": "The login method: login with password is not enabled for the application", + "The login method: login with password is not enabled for the application": "该应用禁止采用密码登录方式", "The provider type: %s is not supported": "不支持该类型的提供商: %s", "The provider: %s is not enabled for the application": "提供商: %s 未被启用", - "The user is forbidden to sign in, please contact the administrator": "该用户被禁止登陆,请联系管理员", + "The user is forbidden to sign in, please contact the administrator": "该用户被禁止登录,请联系管理员", "The user: %s/%s doesn't exist": "用户不存在: %s/%s", - "Turing test failed.": "真人验证失败", + "Turing test failed.": "人机验证失败", "Unauthorized operation": "未授权的操作", "Unknown authentication type (not password or provider), form = %s": "未知的认证类型(非密码或第三方提供商):%s" }, @@ -39,55 +39,52 @@ }, "check": { "Affiliation cannot be blank": "联系方式不可为空", - "DisplayName cannot be blank": "展示名称不可为空", - "DisplayName is not valid real name": "展示名称无效", + "DisplayName cannot be blank": "显示名称不可为空", + "DisplayName is not valid real name": "显示名称必须是真实姓名", "Email already exists": "该邮箱已存在", "Email cannot be empty": "邮箱不可为空", "Email is invalid": "无效邮箱", "Empty username.": "用户名不可为空", "FirstName cannot be blank": "名不可以为空", "LastName cannot be blank": "姓不可以为空", - "Ldap user name or password incorrect": "Ldap密码错误", - "Multiple accounts with same uid, please check your ldap server": "多个帐户具有相同的uid,请检查您的 ldap 服务器", + "Ldap user name or password incorrect": "LDAP密码错误", + "Multiple accounts with same uid, please check your ldap server": "多个帐户具有相同的uid,请检查您的 LDAP 服务器", "Organization does not exist": "组织不存在", "Password must have at least 6 characters": "新密码至少为6位", - "Phone already exists": "该电话已存在", - "Phone cannot be empty": "电话不可为空", - "Phone number is invalid": "无效电话", + "Phone already exists": "该手机号已存在", + "Phone cannot be empty": "手机号不可为空", + "Phone number is invalid": "无效手机号", "Please login first": "请先登录", - "Session outdated, please login again": "Session已过期,请重新登陆", + "Session outdated, please login again": "会话已过期,请重新登录", "The user doesn't exist": "用户不存在", - "The user is forbidden to sign in, please contact the administrator": "该用户被禁止登陆,请联系管理员", + "The user is forbidden to sign in, please contact the administrator": "该用户被禁止登录,请联系管理员", "The user: %s doesn't exist": "用户不存在: %s", "The username may only contain alphanumeric characters, underlines or hyphens, cannot have consecutive hyphens or underlines, and cannot begin or end with a hyphen or underline.": "用户名只能包含字母数字字符、下划线或连字符,不能有连续的连字符或下划线,也不能以连字符或下划线开头或结尾", "Username already exists": "用户名已存在", "Username cannot be an email address": "用户名不可以是邮箱地址", - "Username cannot contain white spaces": "用户名不可以包含空格", - "Username cannot start with a digit": "用户名禁止使用数字作为第一个字符", - "Username is too long (maximum is 39 characters).": "用户名过长(最大长度为39个字符)", + "Username cannot contain white spaces": "用户名禁止包含空格", + "Username cannot start with a digit": "用户名禁止使用数字开头", + "Username is too long (maximum is 39 characters).": "用户名过长(最大允许长度为39个字符)", "Username must have at least 2 characters": "用户名至少要有2个字符", - "You don't have the permission to do this": "用户名至少要有2个字符", - "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again": "You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again", + "You don't have the permission to do this": "无权进行该操作", + "You have entered the wrong password or code too many times, please wait for %d minutes and try again": "密码错误次数已达上限,请在 %d 分后重试", + "password or code is incorrect, you have %d remaining chances": "密码错误,您还有 %d 次尝试的机会", "unsupported password type: %s": "不支持的密码类型: %s" }, - "check_util": { - "You have entered the wrong password or code too many times, please wait for %d minutes and try again": "You have entered the wrong password or code too many times, please wait for %d minutes and try again", - "password or code is incorrect, you have %d remaining chances": "密码错误,您还有 %d 次尝试的机会" - }, "enforcer": { "Please sign in first": "请先登录" }, "ldap": { - "Ldap server exist": "Ldap服务器已存在", + "Ldap server exist": "LDAP服务器已存在", "Missing parameter": "参数丢失" }, "link": { "Please link first": "请先绑定", "This application has no providers": "该应用无提供商", "This application has no providers of type": "应用没有该类型的提供商", - "This provider can't be unlinked": "该提供商不可被链接", - "You are not the global admin, you can't unlink other users": "您不是全局管理员,无法取消链接其他用户", - "You can't unlink yourself, you are not a member of any application": "您无法取消链接,您不是任何应用程序的成员" + "This provider can't be unlinked": "该提供商被禁止解绑", + "You are not the global admin, you can't unlink other users": "您不是全局管理员,无法解绑其他用户", + "You can't unlink yourself, you are not a member of any application": "您无法自行解绑,您不是任何应用程序的成员" }, "organization": { "Only admin can modify the %s.": "仅允许管理员可以修改 %s", @@ -99,12 +96,12 @@ "The user: %s doesn't exist": "用户不存在: %s" }, "provider": { - "Invalid application id": "无效的Application ID", + "Invalid application id": "无效的应用ID", "the provider: %s does not exist": "提供商: %s 不存在" }, "resource": { "User is nil for tag: avatar": "用户头像标签为空", - "Username or fullFilePath is empty: username = %s, fullFilePath = %s": "username或FilePath为空: username = %s, fullFilePath = %s" + "Username or fullFilePath is empty: username = %s, fullFilePath = %s": "username或fullFilePath为空: username = %s, fullFilePath = %s" }, "saml": { "Application %s not found": "应用 %s 未找到" @@ -115,10 +112,10 @@ "service": { "Empty parameters for emailForm: %v": "邮件参数为空: %v", "Invalid Email receivers: %s": " 无效的邮箱接收者: %s", - "Invalid phone receivers: %s": "无效的电话接收者: %s" + "Invalid phone receivers: %s": "无效的手机号接收者: %s" }, "storage": { - "The objectKey: %s is not allowed": "object key :%s 不被允许", + "The objectKey: %s is not allowed": "objectKey :%s 不被允许", "The provider type: %s is not supported": "提供商类型: %s 尚未支持" }, "system_info": { @@ -130,10 +127,10 @@ "Grant_type: %s is not supported in this application": "此应用中不支持此授权类型: %s", "Invalid application or wrong clientSecret": "无效应用或错误的clientSecret", "Invalid client_id": "无效的ClientId", - "Redirect URI: %s doesn't exist in the allowed Redirect URI list": "重定向 URI:%s 在可列表中未找到" + "Redirect URI: %s doesn't exist in the allowed Redirect URI list": "重定向 URI:%s 在许可跳转列表中未找到" }, "user": { - "Display name cannot be empty": "展示名称不可为空", + "Display name cannot be empty": "显示名称不可为空", "New password cannot contain blank space.": "新密码不可以包含空格", "New password must have at least 6 characters": "新密码至少需要6位字符", "The user: %s/%s doesn't exist": "用户不存在: %s/%s" @@ -145,7 +142,7 @@ "No application is found for userId: %s": "找不到该用户的应用程序 %s", "No provider for category: %s is found for application: %s": "找不到该用户的应用程序 %s", "Please login first": "请先登录", - "The provider: %s is not found": "该提供商未找到: %s", + "The provider: %s is not found": "未找到提供商: %s", "The user: %s doesn't exist": "用户不存在: %s" }, "verification": { @@ -154,11 +151,11 @@ "Invalid captcha provider.": "非法的验证码提供商", "Missing parameter": "参数丢失", "Organization does not exist": "组织不存在", - "Phone number is invalid": "非法的电话号码", + "Phone number is invalid": "非法的手机号码", "Please login first": "请先登录", "Turing test failed.": "验证码还未发送", "Unable to get the email modify rule.": "无法得到邮箱修改规则", - "Unable to get the phone modify rule.": "无法得到电话修改规则", + "Unable to get the phone modify rule.": "无法得到手机号修改规则", "Unknown type": "未知类型", "Wrong parameter": "参数错误", "You should verify your code in %d min!": "请在 %d 分钟内输入正确验证码", @@ -166,7 +163,7 @@ }, "webauthn": { "Found no credentials for this user": "该用户没有WebAuthn凭据", - "Please call WebAuthnSigninBegin first": "请先调用 WebAuthnSigninBegi", + "Please call WebAuthnSigninBegin first": "请先调用 WebAuthnSigninBegin", "Please login first": "请先登录", "The user: %s/%s doesn't exist": "用户: %s/%s 不存在" } diff --git a/object/check.go b/object/check.go index 8e500c75..c2775276 100644 --- a/object/check.go +++ b/object/check.go @@ -143,11 +143,11 @@ func checkSigninErrorTimes(user *User, lang string) string { if user.SigninWrongTimes >= SigninWrongTimesLimit { lastSignWrongTime, _ := time.Parse(time.RFC3339, user.LastSigninWrongTime) passedTime := time.Now().UTC().Sub(lastSignWrongTime) - seconds := int(LastSignWrongTimeDuration.Seconds() - passedTime.Seconds()) + minutes := int(LastSignWrongTimeDuration.Minutes() - passedTime.Minutes()) // deny the login if the error times is greater than the limit and the last login time is less than the duration - if seconds > 0 { - return fmt.Sprintf(i18n.Translate(lang, "check:You have entered the wrong password or code too many times, please wait for %d minutes %d seconds and try again"), seconds/60, seconds%60) + if minutes > 0 { + return fmt.Sprintf(i18n.Translate(lang, "check:You have entered the wrong password or code too many times, please wait for %d minutes and try again"), minutes) } // reset the error times diff --git a/object/check_util.go b/object/check_util.go index 4c9e40cc..25637d7c 100644 --- a/object/check_util.go +++ b/object/check_util.go @@ -58,9 +58,9 @@ func recordSigninErrorInfo(user *User, lang string) string { UpdateUser(user.GetId(), user, []string{"signin_wrong_times", "last_signin_wrong_time"}, user.IsGlobalAdmin) leftChances := SigninWrongTimesLimit - user.SigninWrongTimes if leftChances > 0 { - return fmt.Sprintf(i18n.Translate(lang, "check_util:password or code is incorrect, you have %d remaining chances"), leftChances) + return fmt.Sprintf(i18n.Translate(lang, "check:password or code is incorrect, you have %d remaining chances"), leftChances) } // don't show the chance error message if the user has no chance left - return fmt.Sprintf(i18n.Translate(lang, "check_util:You have entered the wrong password or code too many times, please wait for %d minutes and try again"), int(LastSignWrongTimeDuration.Minutes())) + return fmt.Sprintf(i18n.Translate(lang, "check:You have entered the wrong password or code too many times, please wait for %d minutes and try again"), int(LastSignWrongTimeDuration.Minutes())) }