From b48807ba35395a54b683c479e365c4dc173b8002 Mon Sep 17 00:00:00 2001 From: liaohanqin Date: Wed, 11 Jan 2023 18:42:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20802-1x=20=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20identity=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 802-1x 可以修改 identity 字段 Log: 企业认证时可以调整用户名 Task: https://pms.uniontech.com/task-view-212907.html Influence: 网络 Change-Id: I31b9c4f6fefa270e8be952e3798557b0f248c4f3 --- .../networksecretdialog.cpp | 19 ++++++++++++++++--- dnetwork-secret-dialog/networksecretdialog.h | 4 +++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/dnetwork-secret-dialog/networksecretdialog.cpp b/dnetwork-secret-dialog/networksecretdialog.cpp index 64f8e4b30..93655b570 100644 --- a/dnetwork-secret-dialog/networksecretdialog.cpp +++ b/dnetwork-secret-dialog/networksecretdialog.cpp @@ -44,6 +44,7 @@ NetworkSecretDialog::NetworkSecretDialog(QJsonDocument jsonDoc, QWidget *parent) { "IPSec secret", tr("Password") }, { "Xauth password", tr("Group Password") }, }) + , m_propMap({ { "identity", tr("Username") }, }) { m_allInputValid = false; @@ -67,6 +68,7 @@ void NetworkSecretDialog::parseJsonData(const QJsonDocument &jsonDoc) m_connName = m_jsonObj.value("connId").toString(); m_connType = m_jsonObj.value("connType").toString(); m_connSettingName = m_jsonObj.value("settingName").toString(); + m_propsObj = m_jsonObj.value("props").toObject(); for (auto secret : m_jsonObj.value("secrets").toArray()) { m_secretKeyList.append(secret.toString()); } @@ -107,11 +109,22 @@ void NetworkSecretDialog::initUI() for (int row = 0; row < m_secretKeyList.size(); ++row) { const QString &secret = m_secretKeyList.at(row); - DPasswordEdit *lineEdit = new DPasswordEdit(); + + DLineEdit *lineEdit; + QString label; + if (m_propMap.contains(secret)) { + lineEdit = new DLineEdit(); + label = m_propMap.value(secret); + } else { + lineEdit = new DPasswordEdit(); + label = m_secretKeyStrMap.value(secret); + } + if (m_propsObj.contains(secret)) + lineEdit->setText(m_propsObj.value(secret).toString()); lineEdit->setClearButtonEnabled(true); lineEdit->setCopyEnabled(false); lineEdit->setCutEnabled(false); - gridLayout->addWidget(new QLabel(m_secretKeyStrMap.value(secret) + ":"), row, 0); + gridLayout->addWidget(new QLabel(label + ":"), row, 0); gridLayout->addWidget(lineEdit, row, 1); m_lineEditList.append(lineEdit); @@ -168,7 +181,7 @@ void NetworkSecretDialog::checkInputValid() m_lineEditList.at(0)->hideAlertMessage(); for (int i = 0; i < m_secretKeyList.size(); ++i) { - DPasswordEdit * const lineEdit = m_lineEditList.at(i); + DLineEdit * const lineEdit = m_lineEditList.at(i); if (!passwordIsValid(lineEdit->text(), m_secretKeyList.at(i))) { allValid = false; lineEdit->setAlert(true); diff --git a/dnetwork-secret-dialog/networksecretdialog.h b/dnetwork-secret-dialog/networksecretdialog.h index 4439a643c..8e60a1cee 100644 --- a/dnetwork-secret-dialog/networksecretdialog.h +++ b/dnetwork-secret-dialog/networksecretdialog.h @@ -37,12 +37,14 @@ private slots: private: QJsonObject m_jsonObj; const QMap m_secretKeyStrMap; + const QMap m_propMap; QString m_connName; QString m_connType; QString m_connSettingName; QStringList m_secretKeyList; + QJsonObject m_propsObj; - QList m_lineEditList; + QList m_lineEditList; bool m_allInputValid; }; From ab0e5df2145d5348ae17ffe23855eb8825e1091a Mon Sep 17 00:00:00 2001 From: liaohanqin Date: Thu, 12 Jan 2023 14:51:54 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20identity=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20dde-network-core=20=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加 identity 支持 dde-network-core 处理 Log: Task: https://pms.uniontech.com/task-view-212907.html Influence: 无线网络 Change-Id: Ie497219d973b06969baee1bd09af5ebc60225381 --- dnetwork-secret-dialog/networkdialog.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/dnetwork-secret-dialog/networkdialog.cpp b/dnetwork-secret-dialog/networkdialog.cpp index 4d8361675..31786f0b3 100644 --- a/dnetwork-secret-dialog/networkdialog.cpp +++ b/dnetwork-secret-dialog/networkdialog.cpp @@ -90,12 +90,32 @@ bool NetworkDialog::exec(const QJsonDocument &doc) device = array.first().toString(); } QString connName = obj.value("connId").toString(); - if (!connName.isEmpty() && (1 == obj.value("secrets").toArray().size())) { + QJsonObject propsObj = obj.value("props").toObject(); + QString password; + static const char* identity = "identity"; + bool needIdentity = false; + int count = 0; + for (auto secret : obj.value("secrets").toArray()) { + const QString& key = secret.toString(); + if (key == identity) { + needIdentity = true; + continue; + } + count++; + if (propsObj.contains(key)) { + password = propsObj.value(key).toString(); + } + } + if (!connName.isEmpty() && 1 == count) { m_key = connName; QJsonObject json; json.insert("dev", device); json.insert("ssid", m_key); json.insert("wait", true); + if (needIdentity) { + json.insert(identity, propsObj.value(identity).toString()); + } + json.insert("password", password); QJsonDocument doc; doc.setObject(json); m_data = "\nconnect:" + doc.toJson(QJsonDocument::Compact) + "\n";