Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions frontend/src/global/form-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,19 @@ const checkAppName = (rule: any, value: any, callback: any) => {
}
};

const checkAlias = (rule: any, value: any, callback: any) => {
if (!value) {
callback(new Error(i18n.global.t('commons.rule.alias')));
return;
}
const reg = /^(?![-_])[A-Za-z0-9._-]{1,30}(?<![-_])$/;
if (!reg.test(value)) {
callback(new Error(i18n.global.t('commons.rule.alias')));
} else {
callback();
}
};

const checkDomain = (rule: any, value: any, callback: any) => {
if (value === '' || typeof value === 'undefined' || value == null) {
callback(new Error(i18n.global.t('commons.rule.domain')));
Expand Down Expand Up @@ -671,6 +684,7 @@ interface CommonRule {
domainOrIP: FormItemRule;
authBasicPassword: FormItemRule;
ipv4orV6: FormItemRule;
alias: FormItemRule;

paramCommon: FormItemRule;
paramComplexity: FormItemRule;
Expand Down Expand Up @@ -922,4 +936,9 @@ export const Rules: CommonRule = {
validator: checkIpv4orV6,
trigger: 'blur',
},
alias: {
required: true,
validator: checkAlias,
trigger: 'blur',
},
};
1 change: 1 addition & 0 deletions frontend/src/lang/modules/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ const message = {
authBasicPassword: 'Supports letters, numbers, and common special characters, length 1-72',
length128Err: 'Length cannot exceed 128 characters',
maxLength: 'Length cannot exceed {0} characters',
alias: 'Supports English, numbers, - and _, length 1-30, and cannot start or end with -_.',
},
res: {
paramError: 'The request failed, please try again later!',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ const message = {
authBasicPassword: '英字、数字、一般的な特殊文字をサポート、長さ1-72',
length128Err: '長さは128文字を超えることはできません',
maxLength: '長さは {0} 文字を超えることはできません',
alias: '英字、数字、-と_をサポート、長さ1-30、-_で始まるまたは終わることはできません。',
},
res: {
paramError: 'リクエストが失敗しました。後でもう一度やり直してください!',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ const message = {
authBasicPassword: '알파벳, 숫자 및 일반 특수 문자 지원, 길이 1-72',
length128Err: '길이는 128자를 초과할 수 없습니다',
maxLength: '길이는 {0}자를 초과할 수 없습니다',
alias: '영어, 숫자, - 및 _ 지원, 길이 1-30, -_로 시작하거나 끝날 수 없습니다.',
},
res: {
paramError: '요청이 실패했습니다. 나중에 다시 시도하세요!',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/ms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ const message = {
authBasicPassword: 'Menyokong huruf, nombor, dan aksara khas biasa, panjang 1-72',
length128Err: 'Panjang tidak boleh melebihi 128 aksara',
maxLength: 'Panjang tidak boleh melebihi {0} aksara',
alias: 'Menyokong Bahasa Inggeris, nombor, - dan _, panjang 1-30, dan tidak boleh bermula atau berakhir dengan -_.',
},
res: {
paramError: 'Permintaan gagal, sila cuba lagi nanti!',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/pt-br.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ const message = {
authBasicPassword: 'Suporta letras, números e caracteres especiais comuns, comprimento 1-72',
length128Err: 'O comprimento não pode exceder 128 caracteres',
maxLength: 'O comprimento não pode exceder {0} caracteres',
alias: 'Suporta letras, números, - e _, comprimento de 1 a 30, e não pode começar ou terminar com -_.',
},
res: {
paramError: 'A solicitação falhou, por favor, tente novamente mais tarde!',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ const message = {
authBasicPassword: 'Поддерживает буквы, цифры и общие специальные символы, длина 1-72',
length128Err: 'Длина не может превышать 128 символов',
maxLength: 'Длина не может превышать {0} символов',
alias: 'Поддерживает английский, цифры, - и _, длина 1-30, и не может начинаться или заканчиваться на -_.',
},
res: {
paramError: 'Запрос не удался, попробуйте позже!',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/tr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ const message = {
authBasicPassword: 'Harf, rakam ve yaygın özel karakterler destekler, uzunluk 1-72',
length128Err: 'Uzunluk 128 karakteri geçemez',
maxLength: 'Uzunluk {0} karakteri geçemez',
alias: 'İngilizce, rakamlar, - ve _ destekler, uzunluk 1-30, ve -_ ile başlayamaz veya bitiremez.',
},
res: {
paramError: 'İstek başarısız, lütfen daha sonra tekrar deneyin!',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/zh-Hant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ const message = {
authBasicPassword: '支持字母、數字以及常見特殊字符,長度1-72',
length128Err: '長度不能超過128位',
maxLength: '長度不能超過 {0} 位',
alias: '支持英文、數字、-和_,長度1-30,並且不能以-、_開頭或結尾',
},
res: {
paramError: '請求失敗,請稍後重試!',
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lang/modules/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ const message = {
authBasicPassword: '支持字母、数字以及常见特殊字符,长度1-72',
length128Err: '长度不能超过128位',
maxLength: '长度不能超过 {0} 位',
alias: '支持英文、数字、-和_,长度1-30,并且不能以-_开头和结尾',
},
res: {
paramError: '请求失败,请稍后重试!',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/website/website/create/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ const initData = () => ({
const website = ref(initData());
const rules = ref<any>({
primaryDomain: [Rules.domainWithPort],
alias: [Rules.appName],
alias: [Rules.alias],
type: [Rules.requiredInput],
webSiteGroupId: [Rules.requiredSelectBusiness],
appInstallId: [Rules.requiredSelectBusiness],
Expand Down
Loading