diff --git a/client/shared/i18n/langs/en-US/translation.json b/client/shared/i18n/langs/en-US/translation.json index 5a0a13e6..efe5c228 100644 --- a/client/shared/i18n/langs/en-US/translation.json +++ b/client/shared/i18n/langs/en-US/translation.json @@ -145,6 +145,7 @@ "k7173d09e": "Account", "k736edc2f": "Old and new passwords do not match", "k73d9fc70": "Allow members to view admin channels", + "k7431ccfa": "The password is limited to 40 characters at most", "k7437914b": "Panel Group", "k744ee9a": "Create Group", "k74aef1ad": "Members", @@ -194,6 +195,7 @@ "k9d901c20": "Meeting room", "k9dfa2c97": "never expires", "k9f3089ce": "Create", + "k9f7d7de": "Email address is limited to 40 characters", "k9fa72780": "Conversation with {{name}}", "k9fc409ec": "Install Succeed", "ka01a00eb": "System language", diff --git a/client/shared/i18n/langs/zh-CN/translation.json b/client/shared/i18n/langs/zh-CN/translation.json index 06fcabc2..ed331430 100644 --- a/client/shared/i18n/langs/zh-CN/translation.json +++ b/client/shared/i18n/langs/zh-CN/translation.json @@ -145,6 +145,7 @@ "k7173d09e": "账户信息", "k736edc2f": "新旧密码不匹配", "k73d9fc70": "允许成员查看管理频道", + "k7431ccfa": "密码最长限制40个字符", "k7437914b": "面板分组", "k744ee9a": "创建群组", "k74aef1ad": "成员", @@ -194,6 +195,7 @@ "k9d901c20": "会议室", "k9dfa2c97": "永不过期", "k9f3089ce": "创建", + "k9f7d7de": "邮箱最长限制40个字符", "k9fa72780": "与 {{name}} 的会话", "k9fc409ec": "安装成功", "ka01a00eb": "系统语言", diff --git a/client/web/src/components/modals/ClaimTemporaryUser.tsx b/client/web/src/components/modals/ClaimTemporaryUser.tsx index 308568b0..1fcbc943 100644 --- a/client/web/src/components/modals/ClaimTemporaryUser.tsx +++ b/client/web/src/components/modals/ClaimTemporaryUser.tsx @@ -90,12 +90,14 @@ const getFields = (): MetaFormFieldMeta[] => const schema = createMetaFormSchema({ email: metaFormFieldSchema .string() + .required(t('邮箱不能为空')) .email(t('邮箱格式不正确')) - .required(t('邮箱不能为空')), + .max(40, t('邮箱最长限制40个字符')), password: metaFormFieldSchema .string() + .required(t('密码不能为空')) .min(6, t('密码不能低于6位')) - .required(t('密码不能为空')), + .max(40, t('密码最长限制40个字符')), emailOTP: metaFormFieldSchema.string().length(6, t('校验码为6位')), }); diff --git a/client/web/src/routes/Entry/RegisterView.tsx b/client/web/src/routes/Entry/RegisterView.tsx index 69297b24..5006137c 100644 --- a/client/web/src/routes/Entry/RegisterView.tsx +++ b/client/web/src/routes/Entry/RegisterView.tsx @@ -35,11 +35,13 @@ export const RegisterView: React.FC = React.memo(() => { await string() .email(t('邮箱格式不正确')) .required(t('邮箱不能为空')) + .max(40, t('邮箱最长限制40个字符')) .validate(email); await string() .min(6, t('密码不能低于6位')) .required(t('密码不能为空')) + .max(40, t('密码最长限制40个字符')) .validate(password); const data = await registerWithEmail(email, password, emailOTP); diff --git a/server/services/core/user/user.service.ts b/server/services/core/user/user.service.ts index 18f096d7..01d62e3a 100644 --- a/server/services/core/user/user.service.ts +++ b/server/services/core/user/user.service.ts @@ -79,10 +79,10 @@ class UserService extends TcService { this.registerAction('register', this.register, { rest: 'POST /register', params: { - username: [{ type: 'string', optional: true }], - email: [{ type: 'email', optional: true }], - password: 'string', - emailOTP: [{ type: 'string', optional: true }], + username: { type: 'string', optional: true, max: 40 }, + email: { type: 'email', optional: true, max: 40 }, + password: { type: 'string', max: 40 }, + emailOTP: { type: 'string', optional: true }, }, }); this.registerAction('modifyPassword', this.modifyPassword, { @@ -100,10 +100,10 @@ class UserService extends TcService { this.registerAction('claimTemporaryUser', this.claimTemporaryUser, { params: { userId: 'string', - username: [{ type: 'string', optional: true }], - email: 'email', - password: 'string', - emailOTP: [{ type: 'string', optional: true }], + username: { type: 'string', optional: true, max: 40 }, + email: { type: 'email', max: 40 }, + password: { type: 'string', max: 40 }, + emailOTP: { type: 'string', optional: true }, }, }); this.registerAction('forgetPassword', this.forgetPassword, {