修改在线注册的IP校验

This commit is contained in:
fangxiang 2023-02-10 16:31:39 +08:00
parent 2930add85f
commit f4b2e6cd15
1 changed files with 12 additions and 17 deletions

View File

@ -407,6 +407,7 @@ import GlobalData from "src/common/GlobalData";
import QrcodeVue from "qrcode.vue"; import QrcodeVue from "qrcode.vue";
import { Protocol } from "src/entities/WSProtocol"; import { Protocol } from "src/entities/WSProtocol";
import { EDeviceAttribute } from "src/entities/EDeviceAttribute"; import { EDeviceAttribute } from "src/entities/EDeviceAttribute";
import ValidationUtil from "src/common/ValidationUtil";
export default defineComponent({ export default defineComponent({
name: "ComponentRegisterDialog", name: "ComponentRegisterDialog",
@ -650,7 +651,6 @@ export default defineComponent({
} }
if (function_magic_wall.value) { if (function_magic_wall.value) {
attribute |= EDeviceAttribute.ProductMagicWall; attribute |= EDeviceAttribute.ProductMagicWall;
} }
if (function_fusion.value) { if (function_fusion.value) {
attribute |= EDeviceAttribute.ProductFusion; attribute |= EDeviceAttribute.ProductFusion;
@ -692,12 +692,7 @@ export default defineComponent({
} }
}, },
isIpAddress(str: string) { isIpAddress(str: string) {
return ( return ValidationUtil.isIpAddress(str);
str == "localhost" ||
/^(\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])$/.test(
str
)
);
}, },
changeMagic() { changeMagic() {
if (function_magic_wall.value) { if (function_magic_wall.value) {
@ -708,7 +703,7 @@ export default defineComponent({
if (function_fusion.value) { if (function_fusion.value) {
function_magic_wall.value = false; function_magic_wall.value = false;
} }
} },
}; };
}, },
}); });