Skip to content

Commit

Permalink
feat: 802-1x 可以修改 identity 字段
Browse files Browse the repository at this point in the history
802-1x 可以修改 identity 字段

Log: 企业认证时可以调整用户名
Task: https://pms.uniontech.com/task-view-212907.html
Influence: 网络
Change-Id: I31b9c4f6fefa270e8be952e3798557b0f248c4f3
  • Loading branch information
liaohanqin committed Jan 11, 2023
1 parent 32f6240 commit e788605
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
19 changes: 16 additions & 3 deletions dnetwork-secret-dialog/networksecretdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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());
}
Expand Down Expand Up @@ -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->setPlaceholderText(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);

Expand Down Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion dnetwork-secret-dialog/networksecretdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ private slots:
private:
QJsonObject m_jsonObj;
const QMap<QString, QString> m_secretKeyStrMap;
const QMap<QString, QString> m_propMap;
QString m_connName;
QString m_connType;
QString m_connSettingName;
QStringList m_secretKeyList;
QJsonObject m_propsObj;

QList<Dtk::Widget::DPasswordEdit *> m_lineEditList;
QList<Dtk::Widget::DLineEdit *> m_lineEditList;

bool m_allInputValid;
};
Expand Down

0 comments on commit e788605

Please sign in to comment.