diff --git a/nezha-fronted/src/components/common/js/validate.js b/nezha-fronted/src/components/common/js/validate.js index 2f9cfde94..336bebdc6 100644 --- a/nezha-fronted/src/components/common/js/validate.js +++ b/nezha-fronted/src/components/common/js/validate.js @@ -1,7 +1,7 @@ import vm from '../../../main' export function host(rule, value, callback) { - const hostReg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/ + const hostReg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])(\:\d{0,5})?$/ setTimeout(() => { if (hostReg.test(value)) { callback() @@ -69,14 +69,13 @@ export function positiveInteger(rule, value, callback){ }, 100) } -export function url(rule, value, callback){ - let urlReg=''; - let reg=new RegExp(urlReg) +export function domain(rule, value, callback){ + let urlReg=/^(?=^.{3,255}$)[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(\.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+$/; setTimeout(() => { - if (reg.test(value)) { + if (urlReg.test(value)) { callback() } else { - callback(new Error(vm.$t('validate.url'))) + callback(new Error(vm.$t('validate.domain'))) } }, 100) } diff --git a/nezha-fronted/src/components/common/language/en.js b/nezha-fronted/src/components/common/language/en.js index 655b71654..9d27496ca 100644 --- a/nezha-fronted/src/components/common/language/en.js +++ b/nezha-fronted/src/components/common/language/en.js @@ -243,6 +243,7 @@ const en = { email:'Invalid email',//'不合法的E-mail地址' tel:'Invalid phone number',//'不合法的电话号码' host:'Invalid IP',//'不合法的IP' + domain:'Invalid domain', fileSize:'文件过大',//File exceed max size. port:'Invalid Port', url:'Invalid URL', @@ -527,10 +528,11 @@ const en = { scrapeInterval:'Scrape Interval', storageRetention:'Local Retention', systemName:'System Name', - curUrl:'Current URL' + curUrl:'Current site URL' }, email:{ email:'Email', + enable:'Enable Email', smtpHost:'SMTP Host', smtpPort:'SMTP Port', smtpAccount:'SMTP Account', @@ -567,6 +569,10 @@ const en = { metric:'metric', alert:'alert', sysConfig:'system config', + pwdTip:'Please input your password', + promptTitle:'Confirm', + yes:'Yes', + no:'No', } } }, diff --git a/nezha-fronted/src/components/page/config/mib.vue b/nezha-fronted/src/components/page/config/mib.vue index f25f76941..f694099c6 100644 --- a/nezha-fronted/src/components/page/config/mib.vue +++ b/nezha-fronted/src/components/page/config/mib.vue @@ -46,11 +46,11 @@ -