diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2022-05-13 18:01:22 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2022-05-17 14:09:05 +0300 |
commit | 553c707c3f7e94b4e840418e06dd044e0b4ccd29 (patch) | |
tree | f4ef2c7e52040fe43c948e076d6f0535d58158e6 /src/gui | |
parent | c4500ba9dc97f397f7c99a2f9dc8aeceadb3ed28 (diff) |
Ignore all ssl errors once a certificate is accepted
This matches the old behaviour
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/accountstate.cpp | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index 1e6fa507d..8fd3128bd 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -305,26 +305,32 @@ void AccountState::checkConnectivity(bool blockJobs) connect(_connectionValidator, &ConnectionValidator::sslErrors, this, [blockJobs, this](const QList<QSslError> &errors) { if (!_tlsDialog) { - _tlsDialog = new TlsErrorDialog(errors, _account->url().host(), ocApp()->gui()->settingsDialog()); - _tlsDialog->setAttribute(Qt::WA_DeleteOnClose); - QSet<QSslCertificate> certs; - certs.reserve(errors.size()); - for (const auto &error : errors) { - certs << error.certificate(); + // ignore errors for already accepted certificates + auto filteredErrors = _account->accessManager()->filterSslErrors(errors); + if (!filteredErrors.isEmpty()) { + _tlsDialog = new TlsErrorDialog(filteredErrors, _account->url().host(), ocApp()->gui()->settingsDialog()); + _tlsDialog->setAttribute(Qt::WA_DeleteOnClose); + QSet<QSslCertificate> certs; + certs.reserve(filteredErrors.size()); + for (const auto &error : filteredErrors) { + certs << error.certificate(); + } + connect(_tlsDialog, &TlsErrorDialog::accepted, _tlsDialog, [certs, blockJobs, this]() { + _account->addApprovedCerts(certs); + _tlsDialog.clear(); + _waitingForNewCredentials = false; + checkConnectivity(blockJobs); + }); + connect(_tlsDialog, &TlsErrorDialog::rejected, this, [certs, this]() { + setState(SignedOut); + }); + + _tlsDialog->show(); } - connect(_tlsDialog, &TlsErrorDialog::accepted, _tlsDialog, [certs, blockJobs, this]() { - _account->addApprovedCerts(certs); - _tlsDialog.clear(); - _waitingForNewCredentials = false; - checkConnectivity(blockJobs); - }); - connect(_tlsDialog, &TlsErrorDialog::rejected, this, [certs, this]() { - setState(SignedOut); - }); - - _tlsDialog->show(); } - ocApp()->gui()->raiseDialog(_tlsDialog); + if (_tlsDialog) { + ocApp()->gui()->raiseDialog(_tlsDialog); + } }); ConnectionValidator::ValidationMode mode = ConnectionValidator::ValidationMode::ValidateAuthAndUpdate; if (isConnected()) { |