1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

prevent ssl error dialog by website domain

Summary: BUG: 393162

Reviewers: drosca, #falkon

Reviewed By: drosca, #falkon

Subscribers: falkon

Tags: #falkon

Differential Revision: https://phabricator.kde.org/D12522
This commit is contained in:
Anmol Gautam 2018-04-29 19:02:50 +05:30
parent c15b112a4c
commit 61beda4fa2
4 changed files with 16 additions and 3 deletions

View File

@ -71,6 +71,10 @@ bool NetworkManager::certificateError(const QWebEngineCertificateError &error, Q
{
const QString &host = error.url().host();
if (m_rejectedSslErrors.contains(host) && m_rejectedSslErrors.value(host) == error.error()) {
return false;
}
if (m_ignoredSslErrors.contains(host) && m_ignoredSslErrors.value(host) == error.error())
return true;
@ -88,10 +92,13 @@ bool NetworkManager::certificateError(const QWebEngineCertificateError &error, Q
case SslErrorDialog::Yes:
// TODO: Permanent exceptions
case SslErrorDialog::OnlyForThisSession:
m_ignoredSslErrors[error.url().host()] = error.error();
m_ignoredSslErrors[host] = error.error();
return true;
case SslErrorDialog::No:
case SslErrorDialog::NoForThisSession:
m_rejectedSslErrors[host] = error.error();
return false;
default:
return false;
}

View File

@ -55,6 +55,7 @@ private:
NetworkUrlInterceptor *m_urlInterceptor;
ExtensionSchemeManager *m_extensionScheme;
QHash<QString, QWebEngineCertificateError::Error> m_ignoredSslErrors;
QHash<QString, QWebEngineCertificateError::Error> m_rejectedSslErrors;
};
#endif // NETWORKMANAGER_H

View File

@ -63,6 +63,11 @@ void SslErrorDialog::buttonClicked(QAbstractButton* button)
accept();
break;
case QDialogButtonBox::NoRole:
m_result = NoForThisSession;
reject();
break;
default:
m_result = No;
reject();

View File

@ -34,7 +34,7 @@ class FALKON_EXPORT SslErrorDialog : public QDialog
Q_OBJECT
public:
enum Result { Yes, No, OnlyForThisSession };
enum Result { Yes, No, OnlyForThisSession, NoForThisSession };
explicit SslErrorDialog(QWidget* parent = 0);
~SslErrorDialog();