mirror of https://github.com/1Panel-dev/1Panel
feat: 增加主域名和代号的校验
parent
324903f7a0
commit
b1a4d9df00
|
@ -41,11 +41,25 @@ const checkName = (rule: any, value: any, callback: any) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const checkLinuxName = (rule: any, value: any, callback: any) => {
|
||||||
|
if (value === '' || typeof value === 'undefined' || value == null) {
|
||||||
|
callback(new Error(i18n.global.t('commons.rule.linuxName')));
|
||||||
|
} else {
|
||||||
|
const reg = /^[a-zA-Z0-9]{1}[a-zA-Z0-9_.]{0,30}$/;
|
||||||
|
if (!reg.test(value) && value !== '') {
|
||||||
|
callback(new Error(i18n.global.t('commons.rule.linuxName')));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
interface CommonRule {
|
interface CommonRule {
|
||||||
requiredInput: FormItemRule;
|
requiredInput: FormItemRule;
|
||||||
requiredSelect: FormItemRule;
|
requiredSelect: FormItemRule;
|
||||||
requiredSelectBusiness: FormItemRule;
|
requiredSelectBusiness: FormItemRule;
|
||||||
name: FormItemRule;
|
name: FormItemRule;
|
||||||
|
linuxName: FormItemRule;
|
||||||
password: FormItemRule;
|
password: FormItemRule;
|
||||||
email: FormItemRule;
|
email: FormItemRule;
|
||||||
number: FormItemRule;
|
number: FormItemRule;
|
||||||
|
@ -77,6 +91,11 @@ export const Rules: CommonRule = {
|
||||||
validator: checkName,
|
validator: checkName,
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
},
|
},
|
||||||
|
linuxName: {
|
||||||
|
required: true,
|
||||||
|
validator: checkLinuxName,
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
password: {
|
password: {
|
||||||
validator: complexityPassword,
|
validator: complexityPassword,
|
||||||
trigger: 'blur',
|
trigger: 'blur',
|
||||||
|
|
|
@ -100,6 +100,7 @@ export default {
|
||||||
commonName: '支持英文、中文、数字、.-_,长度1-30',
|
commonName: '支持英文、中文、数字、.-_,长度1-30',
|
||||||
complexityPassword: '请输入 8 位以上、必须含有字母、数字、特殊符号的密码',
|
complexityPassword: '请输入 8 位以上、必须含有字母、数字、特殊符号的密码',
|
||||||
commonPassword: '请输入 6 位以上长度密码',
|
commonPassword: '请输入 6 位以上长度密码',
|
||||||
|
linuxName: '支持英文、数字、.-_,长度1-30',
|
||||||
email: '请输入正确的邮箱',
|
email: '请输入正确的邮箱',
|
||||||
number: '请输入正确的数字',
|
number: '请输入正确的数字',
|
||||||
ip: '请输入正确的 IP 地址',
|
ip: '请输入正确的 IP 地址',
|
||||||
|
|
|
@ -141,8 +141,8 @@ const website = ref({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
let rules = ref({
|
let rules = ref({
|
||||||
primaryDomain: [Rules.requiredInput],
|
primaryDomain: [Rules.linuxName],
|
||||||
alias: [Rules.requiredInput],
|
alias: [Rules.linuxName],
|
||||||
type: [Rules.requiredInput],
|
type: [Rules.requiredInput],
|
||||||
webSiteGroupId: [Rules.requiredSelectBusiness],
|
webSiteGroupId: [Rules.requiredSelectBusiness],
|
||||||
appInstallId: [Rules.requiredSelectBusiness],
|
appInstallId: [Rules.requiredSelectBusiness],
|
||||||
|
|
Loading…
Reference in New Issue