feat: 新的认证设置 UI

This commit is contained in:
Chenx Dust
2026-05-24 17:56:01 +08:00
parent 6388c74067
commit 67ef51663d
2 changed files with 418 additions and 219 deletions

View File

@@ -148,7 +148,7 @@ SettingWindow::SettingWindow(QWidget *parent, QSettings *inputSettings, const QS
if (authType == "auth/cas")
{
ui->casRadioButton->setChecked(true);
ui->casLoginUrlLineEdit->setText(loginUrl);
ui->loginUrlLineEdit->setText(loginUrl);
}
else if (authType == "auth/smsCheckCode")
{
@@ -222,7 +222,7 @@ void SettingWindow::loadSettings()
ui->casRadioButton->setChecked(true);
else
ui->pswRadioButton->setChecked(true);
ui->casLoginUrlLineEdit->setText(settings->value("ZJUConnect/CasLoginURL").toString());
ui->loginUrlLineEdit->setText(settings->value("ZJUConnect/CasLoginURL").toString());
ui->countryCodeLineEdit->setText(settings->value("ZJUConnect/PhoneCountryCode").toString());
ui->phoneNumberLineEdit->setText(settings->value("ZJUConnect/PhoneNumber").toString());
@@ -297,7 +297,7 @@ void SettingWindow::applySettings()
settings->setValue("ZJUConnect/Protocol", ui->atrustRadioButton->isChecked() ? "atrust" : "easyconnect");
settings->setValue("ZJUConnect/LoginDomain", ui->loginDomainLineEdit->text());
settings->setValue("ZJUConnect/AuthType", ui->casRadioButton->isChecked() ? "cas" : (ui->smsCheckCodeRadioButton->isChecked() ? "smsCheckCode" : "psw"));
settings->setValue("ZJUConnect/CasLoginURL", ui->casLoginUrlLineEdit->text());
settings->setValue("ZJUConnect/CasLoginURL", ui->loginUrlLineEdit->text());
settings->setValue("ZJUConnect/PhoneCountryCode", ui->countryCodeLineEdit->text());
settings->setValue("ZJUConnect/PhoneNumber", ui->phoneNumberLineEdit->text());
@@ -351,7 +351,7 @@ bool SettingWindow::isAuthSettingChanged()
return currentAuthType != settings->value("ZJUConnect/AuthType").toString() ||
ui->loginDomainLineEdit->text() != settings->value("ZJUConnect/LoginDomain").toString() ||
(currentAuthType == "cas" &&
ui->casLoginUrlLineEdit->text() != settings->value("ZJUConnect/CasLoginURL").toString()) ||
ui->loginUrlLineEdit->text() != settings->value("ZJUConnect/CasLoginURL").toString()) ||
ui->serverAddressLineEdit->text() != settings->value("ZJUConnect/ServerAddress").toString() ||
ui->serverPortSpinBox->value() != settings->value("ZJUConnect/ServerPort").toInt();
}

View File

@@ -240,111 +240,49 @@
<string>认证</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_9">
<item row="2" column="0">
<widget class="QGroupBox" name="authInfoGroupBox">
<property name="title">
<string>认证信息aTrust</string>
<item row="4" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="credentialGroup">
<property name="title">
<string>保存的信息</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QLabel" name="commonTabLable2">
<property name="text">
<string>手机号码</string>
<string>账号</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QLineEdit" name="casLoginUrlLineEdit">
<item row="3" column="4">
<widget class="QCheckBox" name="totpSecretVisibleCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>可选,可自动生成,仅用于单点登录</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QRadioButton" name="casRadioButton">
<property name="text">
<string>单点认证</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QRadioButton" name="pswRadioButton">
<property name="text">
<string>密码</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>单点认证地址</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>登录域</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QRadioButton" name="smsCheckCodeRadioButton">
<property name="text">
<string>短信验证</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>认证方式</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="4">
<widget class="QPushButton" name="authSelectPushButton">
<property name="text">
<string>获取认证方式</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QLineEdit" name="loginDomainLineEdit">
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>可自动获取,默认 local</string>
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="1" colspan="3">
<item row="2" column="2" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_6">
@@ -388,6 +326,149 @@
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="commonTabLable3">
<property name="text">
<string>密码</string>
</property>
</widget>
</item>
<item row="5" column="3" colspan="2">
<widget class="QPushButton" name="certFileBrowseButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>浏览</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="certPasswordLabel">
<property name="text">
<string>证书密码</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QCheckBox" name="passwordVisibleCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="2" colspan="2">
<widget class="QLineEdit" name="certPasswordLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="echoMode">
<enum>QLineEdit::EchoMode::Password</enum>
</property>
<property name="placeholderText">
<string>可选,证书密码</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>手机号码</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="certFileLabel">
<property name="text">
<string>证书文件</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLineEdit" name="certFileLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="placeholderText">
<string>可选p12/pfx 证书文件路径</string>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>120</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2" colspan="3">
<widget class="QLineEdit" name="usernameLineEdit">
<property name="placeholderText">
<string>VPN 账号</string>
</property>
</widget>
</item>
<item row="6" column="4">
<widget class="QCheckBox" name="certPasswordVisibleCheckBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="zjuConnectTabLabel6_2">
<property name="text">
<string>TOTP 密钥</string>
</property>
</widget>
</item>
<item row="3" column="2" colspan="2">
<widget class="QLineEdit" name="totpSecretLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="echoMode">
<enum>QLineEdit::EchoMode::Password</enum>
</property>
<property name="placeholderText">
<string>可选,以通过 TOTP 验证器</string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="2">
<widget class="QLineEdit" name="passwordLineEdit">
<property name="echoMode">
<enum>QLineEdit::EchoMode::Password</enum>
</property>
<property name="placeholderText">
<string>VPN 密码</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -417,75 +498,114 @@
</layout>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="credentialGroup">
<item row="2" column="0">
<widget class="QGroupBox" name="authInfoGroupBox">
<property name="title">
<string>保存的信息</string>
<string>认证信息aTrust</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="3" column="2" colspan="2">
<widget class="QLineEdit" name="totpSecretLineEdit">
<property name="echoMode">
<enum>QLineEdit::EchoMode::Password</enum>
</property>
<property name="placeholderText">
<string>可选,以通过 TOTP 验证器</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="commonTabLable2">
<layout class="QGridLayout" name="gridLayout_8">
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>账号</string>
<string>单点认证地址</string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="2">
<widget class="QLineEdit" name="passwordLineEdit">
<property name="echoMode">
<enum>QLineEdit::EchoMode::Password</enum>
<item row="2" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QRadioButton" name="pswRadioButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>密码</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="smsCheckCodeRadioButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>短信验证</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="casRadioButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>单点认证</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="oauth2RadioButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>网页授权</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">
<widget class="QPushButton" name="authSelectPushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="placeholderText">
<string>VPN 密码</string>
<property name="text">
<string>配置认证方式</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QCheckBox" name="passwordVisibleCheckBox">
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="loginDomainLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2" colspan="3">
<widget class="QLineEdit" name="usernameLineEdit">
<property name="placeholderText">
<string>VPN 账号</string>
<string>可自动获取,默认 local</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="zjuConnectTabLabel6_2">
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>TOTP 密钥</string>
<string>认证方式</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>登录域</string>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="horizontalSpacer_2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
@@ -500,62 +620,29 @@
</property>
</spacer>
</item>
<item row="3" column="4">
<widget class="QCheckBox" name="totpSecretVisibleCheckBox">
<item row="3" column="1" colspan="2">
<widget class="QLineEdit" name="loginUrlLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="commonTabLable3">
<property name="text">
<string>密码</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="certFileLabel">
<property name="text">
<string>证书文件</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLineEdit" name="certFileLineEdit">
<property name="placeholderText">
<string>可选,p12/pfx 证书文件路径</string>
<string>可选,可自动生成,仅用于单点登录</string>
</property>
</widget>
</item>
<item row="5" column="3" colspan="2">
<widget class="QPushButton" name="certFileBrowseButton">
<item row="0" column="2">
<widget class="QCheckBox" name="manualConfigCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>浏览</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="certPasswordLabel">
<property name="text">
<string>证书密码</string>
</property>
</widget>
</item>
<item row="6" column="2" colspan="2">
<widget class="QLineEdit" name="certPasswordLineEdit">
<property name="echoMode">
<enum>QLineEdit::EchoMode::Password</enum>
</property>
<property name="placeholderText">
<string>可选,证书密码</string>
</property>
</widget>
</item>
<item row="6" column="4">
<widget class="QCheckBox" name="certPasswordVisibleCheckBox">
<property name="text">
<string/>
<string>手动配置</string>
</property>
</widget>
</item>
@@ -955,22 +1042,6 @@
</hint>
</hints>
</connection>
<connection>
<sender>casRadioButton</sender>
<signal>toggled(bool)</signal>
<receiver>casLoginUrlLineEdit</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>397</x>
<y>221</y>
</hint>
<hint type="destinationlabel">
<x>327</x>
<y>247</y>
</hint>
</hints>
</connection>
<connection>
<sender>dnsAutoCheckBox</sender>
<signal>toggled(bool)</signal>
@@ -1052,34 +1123,162 @@
</hints>
</connection>
<connection>
<sender>smsCheckCodeRadioButton</sender>
<sender>manualConfigCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>countryCodeLineEdit</receiver>
<receiver>loginDomainLineEdit</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>429</x>
<y>239</y>
<x>445</x>
<y>185</y>
</hint>
<hint type="destinationlabel">
<x>196</x>
<y>297</y>
<x>319</x>
<y>215</y>
</hint>
</hints>
</connection>
<connection>
<sender>smsCheckCodeRadioButton</sender>
<sender>manualConfigCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>phoneNumberLineEdit</receiver>
<receiver>pswRadioButton</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>429</x>
<y>239</y>
<x>445</x>
<y>185</y>
</hint>
<hint type="destinationlabel">
<x>358</x>
<y>297</y>
<x>196</x>
<y>244</y>
</hint>
</hints>
</connection>
<connection>
<sender>manualConfigCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>smsCheckCodeRadioButton</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>445</x>
<y>185</y>
</hint>
<hint type="destinationlabel">
<x>278</x>
<y>244</y>
</hint>
</hints>
</connection>
<connection>
<sender>manualConfigCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>casRadioButton</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>445</x>
<y>185</y>
</hint>
<hint type="destinationlabel">
<x>360</x>
<y>244</y>
</hint>
</hints>
</connection>
<connection>
<sender>manualConfigCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>oauth2RadioButton</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>445</x>
<y>185</y>
</hint>
<hint type="destinationlabel">
<x>442</x>
<y>244</y>
</hint>
</hints>
</connection>
<connection>
<sender>easyconnectRadioButton</sender>
<signal>toggled(bool)</signal>
<receiver>totpSecretLineEdit</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>256</x>
<y>114</y>
</hint>
<hint type="destinationlabel">
<x>298</x>
<y>440</y>
</hint>
</hints>
</connection>
<connection>
<sender>easyconnectRadioButton</sender>
<signal>toggled(bool)</signal>
<receiver>certFileLineEdit</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>256</x>
<y>114</y>
</hint>
<hint type="destinationlabel">
<x>276</x>
<y>475</y>
</hint>
</hints>
</connection>
<connection>
<sender>easyconnectRadioButton</sender>
<signal>toggled(bool)</signal>
<receiver>certPasswordLineEdit</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>256</x>
<y>114</y>
</hint>
<hint type="destinationlabel">
<x>298</x>
<y>505</y>
</hint>
</hints>
</connection>
<connection>
<sender>easyconnectRadioButton</sender>
<signal>toggled(bool)</signal>
<receiver>certPasswordVisibleCheckBox</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>256</x>
<y>114</y>
</hint>
<hint type="destinationlabel">
<x>463</x>
<y>505</y>
</hint>
</hints>
</connection>
<connection>
<sender>easyconnectRadioButton</sender>
<signal>toggled(bool)</signal>
<receiver>totpSecretVisibleCheckBox</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>256</x>
<y>114</y>
</hint>
<hint type="destinationlabel">
<x>463</x>
<y>440</y>
</hint>
</hints>
</connection>