mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
Implement permanent exceptions for SSL certificates, enable only for this session
This commit is contained in:
parent
767c1406e4
commit
34e7eb1713
|
@ -78,8 +78,10 @@ bool NetworkManager::certificateError(const QWebEngineCertificateError &error, Q
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ignoredSslErrors.contains(host) && m_ignoredSslErrors.value(host) == error.error())
|
if ((m_ignoredSslErrors.contains(host) && m_ignoredSslErrors.value(host) == error.error())
|
||||||
|
|| m_ignoredSslHosts.contains(host)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
QString title = tr("SSL Certificate Error!");
|
QString title = tr("SSL Certificate Error!");
|
||||||
QString text1 = tr("The page you are trying to access has the following errors in the SSL certificate:");
|
QString text1 = tr("The page you are trying to access has the following errors in the SSL certificate:");
|
||||||
|
@ -93,7 +95,9 @@ bool NetworkManager::certificateError(const QWebEngineCertificateError &error, Q
|
||||||
|
|
||||||
switch (dialog.result()) {
|
switch (dialog.result()) {
|
||||||
case SslErrorDialog::Yes:
|
case SslErrorDialog::Yes:
|
||||||
// TODO: Permanent exceptions
|
m_ignoredSslHosts.append(host);
|
||||||
|
return true;
|
||||||
|
|
||||||
case SslErrorDialog::OnlyForThisSession:
|
case SslErrorDialog::OnlyForThisSession:
|
||||||
m_ignoredSslErrors[host] = error.error();
|
m_ignoredSslErrors[host] = error.error();
|
||||||
return true;
|
return true;
|
||||||
|
@ -288,10 +292,19 @@ void NetworkManager::loadSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_urlInterceptor->loadSettings();
|
m_urlInterceptor->loadSettings();
|
||||||
|
|
||||||
|
settings.beginGroup("Web-Browser-Settings");
|
||||||
|
m_ignoredSslHosts = settings.value("IgnoredSslHosts", QStringList()).toStringList();
|
||||||
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkManager::shutdown()
|
void NetworkManager::shutdown()
|
||||||
{
|
{
|
||||||
|
Settings settings;
|
||||||
|
settings.beginGroup("Web-Browser-Settings");
|
||||||
|
settings.setValue("IgnoredSslHosts", m_ignoredSslHosts);
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
mApp->webProfile()->setUrlRequestInterceptor(nullptr);
|
mApp->webProfile()->setUrlRequestInterceptor(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ private:
|
||||||
ExtensionSchemeManager *m_extensionScheme;
|
ExtensionSchemeManager *m_extensionScheme;
|
||||||
QHash<QString, QWebEngineCertificateError::Error> m_ignoredSslErrors;
|
QHash<QString, QWebEngineCertificateError::Error> m_ignoredSslErrors;
|
||||||
QHash<QString, QWebEngineCertificateError::Error> m_rejectedSslErrors;
|
QHash<QString, QWebEngineCertificateError::Error> m_rejectedSslErrors;
|
||||||
|
QStringList m_ignoredSslHosts;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NETWORKMANAGER_H
|
#endif // NETWORKMANAGER_H
|
||||||
|
|
|
@ -28,8 +28,7 @@ SslErrorDialog::SslErrorDialog(QWidget* parent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->icon->setPixmap(IconProvider::standardIcon(QStyle::SP_MessageBoxCritical).pixmap(52));
|
ui->icon->setPixmap(IconProvider::standardIcon(QStyle::SP_MessageBoxCritical).pixmap(52));
|
||||||
// Disabled until there is reliable way to save certificate error
|
ui->buttonBox->addButton(tr("Only for this session"), QDialogButtonBox::ApplyRole);
|
||||||
//ui->buttonBox->addButton(tr("Only for this session"), QDialogButtonBox::ApplyRole);
|
|
||||||
ui->buttonBox->button(QDialogButtonBox::No)->setFocus();
|
ui->buttonBox->button(QDialogButtonBox::No)->setFocus();
|
||||||
|
|
||||||
connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &SslErrorDialog::buttonClicked);
|
connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &SslErrorDialog::buttonClicked);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user