fix: 修复注册账号时没有增加长度限制的bug

增加限制,邮箱和密码最长40字符
pull/70/head
moonrailgun 2 years ago
parent adc644148f
commit 2ed79fb5dd

@ -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",

@ -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": "系统语言",

@ -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位')),
});

@ -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);

@ -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, {

Loading…
Cancel
Save