修改在线注册的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

@ -314,7 +314,7 @@
/> />
<q-checkbox <q-checkbox
v-model="function_fusion" v-model="function_fusion"
@update:model-value="changeFusion()" @update:model-value="changeFusion()"
:label="$t('fusion')" :label="$t('fusion')"
color="cyan" color="cyan"
class="offset-md-1 col" class="offset-md-1 col"
@ -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,11 +651,10 @@ 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;
} }
GlobalData.getInstance() GlobalData.getInstance()
.getCurrentClient() .getCurrentClient()
@ -692,23 +692,18 @@ 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) {
function_fusion.value=false; function_fusion.value = false;
} }
}, },
changeFusion(){ changeFusion() {
if(function_fusion.value){ if (function_fusion.value) {
function_magic_wall.value=false; function_magic_wall.value = false;
} }
} },
}; };
}, },
}); });