详情页安全类型判断

This commit is contained in:
jzxc95 2021-11-10 09:59:29 +08:00
parent 87bcac02cb
commit 2bb5bbd283
1 changed files with 58 additions and 16 deletions

View File

@ -429,6 +429,7 @@ void NetDetail::getBaseInfo(ConInfo &conInfo)
conInfo.strChan = QString::number(item.m_channel);
//无线特有
conInfo.strSecType = item.m_secuType;
qDebug() << "[NetDetail] strSecType = " << conInfo.strSecType;
if (conInfo.strSecType.isEmpty()) {
conInfo.strSecType = "None";
}
@ -723,6 +724,28 @@ bool NetDetail::createWiredConnect()
bool NetDetail::createWirelessConnect()
{
KyWirelessConnectSetting connetSetting;
KySecuType secuType;
KyEapMethodType enterpriseType;
securityPage->getSecuType(secuType, enterpriseType);
//类型判断
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
if(m_info.strSecType.indexOf("802.1X") < 0) {
showDesktopNotify(tr("this wifi no support enterprise type"));
return false;
}
} else if (secuType == NONE && m_info.strSecType != "None") {
showDesktopNotify(tr("this wifi no support None type"));
return false;
} else if (secuType == WPA_AND_WPA2_PERSONAL
&& (m_info.strSecType.indexOf("WPA1") < 0 ||
m_info.strSecType.indexOf("WPA2") < 0)) {
showDesktopNotify(tr("this wifi no support WPA1 WPA2 type"));
return false;
} else if (secuType == WPA3_PERSONAL && m_info.strSecType.indexOf("WPA3") < 0) {
showDesktopNotify(tr("this wifi no support WPA3 type"));
return false;
}
//基本信息
QString ssid;
if (m_name.isEmpty()) {
@ -766,9 +789,6 @@ bool NetDetail::createWirelessConnect()
}
}
//wifi安全性
KySecuType secuType;
KyEapMethodType enterpriseType;
securityPage->getSecuType(secuType, enterpriseType);
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
connetSetting.m_type = WpaEap;
if (enterpriseType == TLS) {
@ -817,8 +837,37 @@ bool NetDetail::updateConnect()
{
KyConnectResourse *kyConnectResourse = new KyConnectResourse(this);
KyConnectSetting connetSetting;
KySecuType secuType;
KyEapMethodType enterpriseType;
kyConnectResourse->getConnectionSetting(m_uuid,connetSetting);
bool securityChange = false;
if (isWlan) {
securityChange = securityPage->checkIsChanged(m_info);
if(securityChange) {
securityPage->getSecuType(secuType, enterpriseType);
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
if(m_info.strSecType.indexOf("802.1X") < 0) {
showDesktopNotify(tr("this wifi no support enterprise type"));
return false;
}
} else {
if (secuType == NONE && m_info.strSecType != "None") {
showDesktopNotify(tr("this wifi no support None type"));
return false;
} else if (secuType == WPA_AND_WPA2_PERSONAL
&& (m_info.strSecType.indexOf("WPA1") < 0 ||
m_info.strSecType.indexOf("WPA2") < 0)) {
showDesktopNotify(tr("this wifi no support WPA2 type"));
return false;
} else if (secuType == WPA3_PERSONAL && m_info.strSecType.indexOf("WPA3") < 0) {
showDesktopNotify(tr("this wifi no support WPA3 type"));
return false;
}
}
}
}
if(!m_uuid.isEmpty() && detailPage->checkIsChanged(m_info)) {
m_wirelessConnOpration->setWirelessAutoConnect(m_uuid, !m_info.isAutoConnect);
}
@ -849,21 +898,14 @@ bool NetDetail::updateConnect()
m_wiredConnOperation->updateWiredConnect(m_uuid, connetSetting);
}
bool securityChange = false;
if (isWlan) {
securityChange = securityPage->checkIsChanged(m_info);
qDebug() << "securityChange" << securityChange;
if (securityChange) {
KySecuType secuType;
KyEapMethodType enterpriseType;
securityPage->getSecuType(secuType, enterpriseType);
if (secuType == WPA_AND_WPA2_ENTERPRISE) {
updateWirelessEnterPriseConnect(enterpriseType);
} else {
updateWirelessPersonalConnect();
}
}
}
if (ipv4Change || ipv6Change || securityChange) {
if (isActive) {