Browse Source

feat(gui-v2): importUrlValidator

pull/2795/head
Wing-Kam Wong 2 years ago
parent
commit
33dbe0a102
  1. 13
      packages/nc-gui-v2/utils/validation.ts

13
packages/nc-gui-v2/utils/validation.ts

@ -82,3 +82,16 @@ export const fieldRequiredValidator = {
required: true,
message: 'Field is required',
}
export const importUrlValidator = {
validator: (rule: any, value: any, callback: (errMsg?: string) => void) => {
if (
/(10)(\.([2]([0-5][0-5]|[01234][6-9])|[1][0-9][0-9]|[1-9][0-9]|[0-9])){3}|(172)\.(1[6-9]|2[0-9]|3[0-1])(\.(2[0-4][0-9]|25[0-5]|[1][0-9][0-9]|[1-9][0-9]|[0-9])){2}|(192)\.(168)(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){2}|(0.0.0.0)|localhost?/g.test(
value,
)
) {
callback('IP Not allowed!')
}
callback()
},
}

Loading…
Cancel
Save