1
0
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:
zhengkunwang 2024-04-15 11:56:10 +08:00 committed by GitHub
parent c77742e72e
commit 8625979cc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 23 additions and 1 deletions

View File

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

View File

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

View File

@ -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}等符號',

View File

@ -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}等符号',

View File

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