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:
parent
c15b112a4c
commit
61beda4fa2
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -63,6 +63,11 @@ void SslErrorDialog::buttonClicked(QAbstractButton* button)
|
||||
accept();
|
||||
break;
|
||||
|
||||
case QDialogButtonBox::NoRole:
|
||||
m_result = NoForThisSession;
|
||||
reject();
|
||||
break;
|
||||
|
||||
default:
|
||||
m_result = No;
|
||||
reject();
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user