rr validation
This commit is contained in:
parent
58c66fc3a8
commit
2ab1b0bf1b
@ -186,6 +186,30 @@ const rules = {
|
|||||||
return new Error(t('common.mandatory'))
|
return new Error(t('common.mandatory'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (props.record.name.includes(' ')) {
|
||||||
|
invalidData.value &= ~validationFlags.name
|
||||||
|
return new Error(t('records.errors.hasSpace'))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.record.name.startsWith('.') || props.record.name.endsWith('.')) {
|
||||||
|
invalidData.value &= ~validationFlags.name
|
||||||
|
return new Error(t('records.errors.badName.dotAndMinus'))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.record.name.startsWith('-') || props.record.name.endsWith('-')) {
|
||||||
|
invalidData.value &= ~validationFlags.name
|
||||||
|
return new Error(t('records.errors.badName.dotAndMinus'))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.record.name.includes('..')) {
|
||||||
|
invalidData.value &= ~validationFlags.name
|
||||||
|
return new Error(t('records.errors.badName.doubleDots'))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.record.name.split('.').filter(e => e.length > 63).length > 0) {
|
||||||
|
invalidData.value &= ~validationFlags.name
|
||||||
|
return new Error(t('records.errors.badName.longerThan63'))
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -216,6 +240,10 @@ const rules = {
|
|||||||
return new Error(t('common.mandatory'))
|
return new Error(t('common.mandatory'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r.host.includes(' ')) {
|
||||||
|
invalidData.value &= ~validationFlags.content
|
||||||
|
return new Error(t('records.errors.hasSpace'))
|
||||||
|
}
|
||||||
|
|
||||||
if (!r.host.endsWith('.')) {
|
if (!r.host.endsWith('.')) {
|
||||||
invalidData.value &= ~validationFlags.content
|
invalidData.value &= ~validationFlags.content
|
||||||
@ -268,6 +296,11 @@ const rules = {
|
|||||||
return new Error(t('common.mandatory'))
|
return new Error(t('common.mandatory'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r.host.includes(' ')) {
|
||||||
|
invalidData.value &= ~validationFlags.content
|
||||||
|
return new Error(t('records.errors.hasSpace'))
|
||||||
|
}
|
||||||
|
|
||||||
if (!r.host.endsWith('.')) {
|
if (!r.host.endsWith('.')) {
|
||||||
invalidData.value &= ~validationFlags.content
|
invalidData.value &= ~validationFlags.content
|
||||||
return new Error(t('records.errors.endWithDot'))
|
return new Error(t('records.errors.endWithDot'))
|
||||||
@ -288,6 +321,11 @@ const rules = {
|
|||||||
return new Error(t('common.mandatory'))
|
return new Error(t('common.mandatory'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r.target.includes(' ')) {
|
||||||
|
invalidData.value &= ~validationFlags.content
|
||||||
|
return new Error(t('records.errors.hasSpace'))
|
||||||
|
}
|
||||||
|
|
||||||
if (!r.target.endsWith('.')) {
|
if (!r.target.endsWith('.')) {
|
||||||
invalidData.value &= ~validationFlags.content
|
invalidData.value &= ~validationFlags.content
|
||||||
return new Error(t('records.errors.endWithDot'))
|
return new Error(t('records.errors.endWithDot'))
|
||||||
@ -308,6 +346,11 @@ const rules = {
|
|||||||
return new Error(t('common.mandatory'))
|
return new Error(t('common.mandatory'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r.tag.includes(' ')) {
|
||||||
|
invalidData.value &= ~validationFlags.content
|
||||||
|
return new Error(t('records.errors.hasSpace'))
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ export default {
|
|||||||
},
|
},
|
||||||
records: {
|
records: {
|
||||||
'_': 'Record',
|
'_': 'Record',
|
||||||
name: 'Record Name',
|
name: 'Resource Record',
|
||||||
recordType: 'Type',
|
recordType: 'Type',
|
||||||
content: 'Record',
|
content: 'Record',
|
||||||
search: 'Search...',
|
search: 'Search...',
|
||||||
@ -83,8 +83,14 @@ export default {
|
|||||||
|
|
||||||
errors: {
|
errors: {
|
||||||
endWithDot: 'should end with a dot',
|
endWithDot: 'should end with a dot',
|
||||||
|
hasSpace: 'shoule have no space',
|
||||||
badIPv4: 'invalid IPv4 address',
|
badIPv4: 'invalid IPv4 address',
|
||||||
badIPv6: 'invalid IPv6 address',
|
badIPv6: 'invalid IPv6 address',
|
||||||
|
badName: {
|
||||||
|
dotAndMinus: 'should not start or end with "." "-"',
|
||||||
|
doubleDots: 'should have no contianus "."',
|
||||||
|
logerThan63: 'should not longer than 63 characters splited by "."'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -58,7 +58,7 @@ export default {
|
|||||||
},
|
},
|
||||||
records: {
|
records: {
|
||||||
'_': '记录',
|
'_': '记录',
|
||||||
name: '记录名',
|
name: '资源记录',
|
||||||
recordType: '类型',
|
recordType: '类型',
|
||||||
content: '记录值',
|
content: '记录值',
|
||||||
search: '搜索...',
|
search: '搜索...',
|
||||||
@ -83,8 +83,14 @@ export default {
|
|||||||
|
|
||||||
errors: {
|
errors: {
|
||||||
endWithDot: '应当以 . 结尾',
|
endWithDot: '应当以 . 结尾',
|
||||||
|
hasSpace: '不能有空格',
|
||||||
badIPv4: '不是有效的 IPv4 地址',
|
badIPv4: '不是有效的 IPv4 地址',
|
||||||
badIPv6: '不是有效的 IPv6 地址',
|
badIPv6: '不是有效的 IPv6 地址',
|
||||||
|
badName: {
|
||||||
|
dotAndMinus: '资源记录不能以 "."、"-" 开头或结尾',
|
||||||
|
doubleDots: '资源记录不能有连续的 "."',
|
||||||
|
logerThan63: '资源记录以 "." 分割的每个字符串长度不能超过63字符'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user