fix: release resources when properly

This commit is contained in:
Kevin Yue 2022-06-06 18:05:08 +08:00
parent 3067e6e911
commit 7bc02a4208
3 changed files with 14 additions and 5 deletions

View File

@ -307,7 +307,7 @@ void GPClient::onPortalSuccess(const PortalConfigResponse portalConfig, const QS
{ {
PLOGI << "Portal authentication succeeded."; PLOGI << "Portal authentication succeeded.";
// No gateway found in protal configuration // No gateway found in portal configuration
if (portalConfig.allGateways().size() == 0) { if (portalConfig.allGateways().size() == 0) {
PLOGI << "No gateway found in portal configuration, treat the portal address as a gateway."; PLOGI << "No gateway found in portal configuration, treat the portal address as a gateway.";
tryGatewayLogin(); tryGatewayLogin();

View File

@ -33,7 +33,7 @@ QNetworkReply* gpclient::helper::createRequest(QString url, QByteArray params)
GPGateway gpclient::helper::filterPreferredGateway(QList<GPGateway> gateways, const QString ruleName) GPGateway gpclient::helper::filterPreferredGateway(QList<GPGateway> gateways, const QString ruleName)
{ {
PLOGI << gateways.size() << " gateway(s) avaiable, filter the gateways with rule: " << ruleName; PLOGI << gateways.size() << " gateway(s) available, filter the gateways with rule: " << ruleName;
GPGateway gateway = gateways.first(); GPGateway gateway = gateways.first();

View File

@ -122,9 +122,18 @@ void PortalAuthenticator::samlAuth()
SAMLLoginWindow *loginWindow = new SAMLLoginWindow; SAMLLoginWindow *loginWindow = new SAMLLoginWindow;
connect(loginWindow, &SAMLLoginWindow::success, this, &PortalAuthenticator::onSAMLLoginSuccess); connect(loginWindow, &SAMLLoginWindow::success, [this, loginWindow](const QMap<QString, QString> samlResult) {
connect(loginWindow, &SAMLLoginWindow::fail, this, &PortalAuthenticator::onSAMLLoginFail); onSAMLLoginSuccess(samlResult);
connect(loginWindow, &SAMLLoginWindow::rejected, this, &PortalAuthenticator::onLoginWindowRejected); loginWindow->deleteLater();
});
connect(loginWindow, &SAMLLoginWindow::fail, [this, loginWindow](const QString msg) {
onSAMLLoginFail(msg);
loginWindow->deleteLater();
});
connect(loginWindow, &SAMLLoginWindow::rejected, [this, loginWindow]() {
onLoginWindowRejected();
loginWindow->deleteLater();
});
loginWindow->login(preloginResponse.samlMethod(), preloginResponse.samlRequest(), preloginUrl); loginWindow->login(preloginResponse.samlMethod(), preloginResponse.samlRequest(), preloginUrl);
} }