Add option for returning expired credentials

This commit is contained in:
varjolintu 2019-05-09 08:46:16 +03:00 committed by Jonathan White
parent 247b85fe69
commit fed8a56098
5 changed files with 29 additions and 1 deletions

View File

@ -120,6 +120,7 @@ void BrowserOptionDialog::loadSettings()
m_ui->useCustomProxy->setChecked(settings->useCustomProxy());
m_ui->customProxyLocation->setText(settings->customProxyLocation());
m_ui->updateBinaryPath->setChecked(settings->updateBinaryPath());
m_ui->allowExpiredCredentials->setChecked(settings->allowExpiredCredentials());
m_ui->chromeSupport->setChecked(settings->chromeSupport());
m_ui->chromiumSupport->setChecked(settings->chromiumSupport());
m_ui->firefoxSupport->setChecked(settings->firefoxSupport());
@ -176,6 +177,7 @@ void BrowserOptionDialog::saveSettings()
settings->setCustomProxyLocation(m_ui->customProxyLocation->text());
settings->setUpdateBinaryPath(m_ui->updateBinaryPath->isChecked());
settings->setAllowExpiredCredentials(m_ui->allowExpiredCredentials->isChecked());
settings->setAlwaysAllowAccess(m_ui->alwaysAllowAccess->isChecked());
settings->setAlwaysAllowUpdate(m_ui->alwaysAllowUpdate->isChecked());
settings->setHttpAuthPermission(m_ui->httpAuthPermission->isChecked());

View File

@ -219,6 +219,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="allowExpiredCredentials">
<property name="toolTip">
<string>Returns expired credentials. String [expired] is added to the title.</string>
</property>
<property name="text">
<string>&amp;Allow returning expired credentials.</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="sortByTitle">
<property name="text">

View File

@ -818,6 +818,10 @@ QJsonObject BrowserService::prepareEntry(const Entry* entry)
res["totp"] = entry->totp();
}
if (entry->isExpired()) {
res["expired"] = "true";
}
if (browserSettings()->supportKphFields()) {
const EntryAttributes* attr = entry->attributes();
QJsonArray stringFields;
@ -841,7 +845,7 @@ BrowserService::checkAccess(const Entry* entry, const QString& host, const QStri
return Unknown;
}
if (entry->isExpired()) {
return Denied;
return browserSettings()->allowExpiredCredentials() ? Allowed : Denied;
}
if ((config.isAllowed(host)) && (submitHost.isEmpty() || config.isAllowed(submitHost))) {
return Allowed;

View File

@ -194,6 +194,16 @@ void BrowserSettings::setUpdateBinaryPath(bool enabled)
config()->set("Browser/UpdateBinaryPath", enabled);
}
bool BrowserSettings::allowExpiredCredentials()
{
return config()->get("Browser/AllowExpiredCredentials", false).toBool();
}
void BrowserSettings::setAllowExpiredCredentials(bool enabled)
{
config()->set("Browser/AllowExpiredCredentials", enabled);
}
bool BrowserSettings::chromeSupport()
{
return m_hostInstaller.checkIfInstalled(HostInstaller::SupportedBrowsers::CHROME);

View File

@ -64,6 +64,8 @@ public:
void setCustomProxyLocation(const QString& location);
bool updateBinaryPath();
void setUpdateBinaryPath(bool enabled);
bool allowExpiredCredentials();
void setAllowExpiredCredentials(bool enabled);
bool chromeSupport();
void setChromeSupport(bool enabled);
bool chromiumSupport();