mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 16:29:17 +08:00
feat: 修改 supervisor 名称限制 (#4513)
This commit is contained in:
parent
c77742e72e
commit
8625979cc3
@ -219,6 +219,19 @@ const checkLinuxName = (rule: any, value: any, callback: any) => {
|
||||
}
|
||||
};
|
||||
|
||||
const checkSupervisorName = (rule: any, value: any, callback: any) => {
|
||||
if (value === '' || typeof value === 'undefined' || value == null) {
|
||||
callback(new Error(i18n.global.t('commons.rule.supervisorName')));
|
||||
} else {
|
||||
const reg = /^[a-zA-Z0-9]{1}[a-zA-Z0-9_-]{1,128}$/;
|
||||
if (!reg.test(value) && value !== '') {
|
||||
callback(new Error(i18n.global.t('commons.rule.supervisorName')));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const checkDatabaseName = (rule: any, value: any, callback: any) => {
|
||||
if (value === '' || typeof value === 'undefined' || value == null) {
|
||||
callback(new Error(i18n.global.t('commons.rule.databaseName')));
|
||||
@ -534,6 +547,7 @@ interface CommonRule {
|
||||
domainWithPort: FormItemRule;
|
||||
filePermission: FormItemRule;
|
||||
phpExtensions: FormItemRule;
|
||||
supervisorName: FormItemRule;
|
||||
|
||||
paramCommon: FormItemRule;
|
||||
paramComplexity: FormItemRule;
|
||||
@ -724,6 +738,11 @@ export const Rules: CommonRule = {
|
||||
trigger: 'blur',
|
||||
validator: checkLeechExts,
|
||||
},
|
||||
supervisorName: {
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
validator: checkSupervisorName,
|
||||
},
|
||||
paramSimple: {
|
||||
required: true,
|
||||
trigger: 'blur',
|
||||
|
@ -172,6 +172,7 @@ const message = {
|
||||
dbName: 'Supports non-special character starting, including English, Chinese, numbers, .-_, with a length of 1-64',
|
||||
imageName: 'Support English, numbers, :/.-_, length 1-150',
|
||||
volumeName: 'Support English, numbers, .-_, length 2-30',
|
||||
supervisorName: 'Supports non-special characters starting with English, numbers, - and _, length 1-128',
|
||||
complexityPassword:
|
||||
'Please enter a password combination with a length of 8-30 characters, including letters, numbers, and at least two special characters.',
|
||||
commonPassword: 'Please enter a password with more than 6 characters',
|
||||
|
@ -172,6 +172,7 @@ const message = {
|
||||
dbName: '支持非特殊字符開頭,英文、中文、數字、.-_,長度1-64',
|
||||
imageName: '支持英文、數字、:/.-_,長度1-150',
|
||||
volumeName: '支持英文、數字、.-和_,長度2-30',
|
||||
supervisorName: '支援非特殊字元開頭,英文、數字、-和_,長度1-128',
|
||||
complexityPassword: '請輸入長度為 8-30 位,並包含字母、數字、至少兩種特殊字符的密碼組合',
|
||||
commonPassword: '請輸入 6 位以上長度密碼',
|
||||
linuxName: '長度1-128,名稱不能含有{0}等符號',
|
||||
|
@ -172,6 +172,7 @@ const message = {
|
||||
dbName: '支持非特殊字符开头,英文、中文、数字、.-_,长度1-64',
|
||||
imageName: '支持英文、数字、:/.-_,长度1-150',
|
||||
volumeName: '支持英文、数字、.-和_,长度2-30',
|
||||
supervisorName: '支持非特殊字符开头,英文、数字、-和_,长度1-128',
|
||||
complexityPassword: '请输入长度为 8-30 位且包含字母、数字、特殊字符至少两项的密码组合',
|
||||
commonPassword: '请输入 6 位以上长度密码',
|
||||
linuxName: '长度1-128,名称不能含有{0}等符号',
|
||||
|
@ -54,7 +54,7 @@ const open = ref(false);
|
||||
const loading = ref(false);
|
||||
const processForm = ref<FormInstance>();
|
||||
const rules = ref({
|
||||
name: [Rules.requiredInput, Rules.linuxName],
|
||||
name: [Rules.requiredInput, Rules.supervisorName],
|
||||
dir: [Rules.requiredInput],
|
||||
command: [Rules.requiredInput],
|
||||
user: [Rules.requiredInput],
|
||||
|
Loading…
x
Reference in New Issue
Block a user