Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

fix: Fix some issues

albert544b8557039c
diff --git a/core/frontend/src/i18n/lang/en.json b/core/frontend/src/i18n/lang/en.json
index 50d6dba9..d8705ba2 100644
--- a/core/frontend/src/i18n/lang/en.json
+++ b/core/frontend/src/i18n/lang/en.json
@@ -689,7 +689,8 @@
"createNow":"Create Immediately",
"brandInfo":"Brand information",
"noBrandInfo":"No brand information available.",
- "fillDomain":"Please fill in the domain name"
+ "fillDomain":"Please fill in the domain name",
+ "fillValidDomain":"Please fill in a valid domain name"
},
"projectDetails": {
"title": "Project Details",
diff --git a/core/frontend/src/i18n/lang/zh.json b/core/frontend/src/i18n/lang/zh.json
index b0b4cfe8..7edd74b2 100644
--- a/core/frontend/src/i18n/lang/zh.json
+++ b/core/frontend/src/i18n/lang/zh.json
@@ -599,7 +599,8 @@
"createImmediately":"立即创建",
"brandInfo":"品牌信息",
"noBrandInfo":"暂无品牌信息",
- "fillDomain":"请填写域名"
+ "fillDomain":"请填写域名",
+ "fillValidDomain":"请填写正确的域名"
},
"dns": {
"title": "DNS 记录",
diff --git a/core/frontend/src/utils/base.ts b/core/frontend/src/utils/base.ts
index 4fdbc9b1..165a1e6f 100644
--- a/core/frontend/src/utils/base.ts
+++ b/core/frontend/src/utils/base.ts
@@ -59,3 +59,12 @@ export const capitalizeFirstLetter = (val: string) => {
.map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
.join(' ')
}
+
+
+/**
+ * @description Validate a URL
+ */
+export function isUrl(url: string): boolean {
+ const urlRegex = /^(https?:\/\/)?((([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,})|((\d{1,3}\.){3}\d{1,3}))(:\d{1,5})?(\/.*)?$/;
+ return urlRegex.test(url);
+}
\ No newline at end of file
diff --git a/core/frontend/src/views/domain/pages/editDomain/controller/domainConfiguration.controller.ts b/core/frontend/src/views/domain/pages/editDomain/controller/domainConfiguration.controller.ts
index ea94d7fe..2cceeffc 100644
--- a/core/frontend/src/views/domain/pages/editDomain/controller/domainConfiguration.controller.ts
+++ b/core/frontend/src/views/domain/pages/editDomain/controller/domainConfiguration.controller.ts
@@ -1,7 +1,7 @@
import { instance } from '@/api'
import { instanceOptions } from './companyProfile.controller'
import { getEditDomainStoreData } from '../store'
-import { getByteUnit, Message } from '@/utils'
+import { getByteUnit, Message,isUrl } from '@/utils'
import { initAiConfiguration } from '@/api/modules/domain'
import { useGlobalStore } from '@/store'
import i18n from '@/i18n'
@@ -116,6 +116,9 @@ export async function createBrandInfo() {
hasGotDomainConfiguration.value = false
if (urls.value.length == 0 || urls.value[0] == '') {
Message.error(i18n.global.t('domain.edit.domainConfiguration.fillDomain'))
+ }else if(!isUrl(urls.value[0])) {
+ Message.error(i18n.global.t('domain.edit.domainConfiguration.fillValidDomain'))
+
} else {
try {
await initAiConfiguration({