Use full user id at host with port for proxy password keychain

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2024-07-08 17:41:13 +08:00
parent ef59399804
commit 37c77d81ec
No known key found for this signature in database
GPG key ID: C839200C384636B0

View file

@ -360,7 +360,7 @@ void AccountManager::saveAccountHelper(Account *acc, QSettings &settings, bool s
settings.setValue(networkUploadLimitC, acc->uploadLimit()); settings.setValue(networkUploadLimitC, acc->uploadLimit());
settings.setValue(networkDownloadLimitC, acc->downloadLimit()); settings.setValue(networkDownloadLimitC, acc->downloadLimit());
const auto proxyPasswordKey = QString(acc->davUser() + networkProxyPasswordKeychainKeySuffixC); const auto proxyPasswordKey = QString(acc->userIdAtHostWithPort() + networkProxyPasswordKeychainKeySuffixC);
if (const auto proxyPassword = acc->proxyPassword(); proxyPassword.isEmpty()) { if (const auto proxyPassword = acc->proxyPassword(); proxyPassword.isEmpty()) {
const auto job = new QKeychain::DeletePasswordJob(Theme::instance()->appName(), this); const auto job = new QKeychain::DeletePasswordJob(Theme::instance()->appName(), this);
job->setKey(proxyPasswordKey); job->setKey(proxyPasswordKey);
@ -525,7 +525,7 @@ AccountPtr AccountManager::loadAccountHelper(QSettings &settings)
acc->setUploadLimit(settings.value(networkUploadLimitC).toInt()); acc->setUploadLimit(settings.value(networkUploadLimitC).toInt());
acc->setDownloadLimit(settings.value(networkDownloadLimitC).toInt()); acc->setDownloadLimit(settings.value(networkDownloadLimitC).toInt());
const auto proxyPasswordKey = QString(acc->davUser() + networkProxyPasswordKeychainKeySuffixC); const auto proxyPasswordKey = QString(acc->userIdAtHostWithPort() + networkProxyPasswordKeychainKeySuffixC);
const auto job = new QKeychain::ReadPasswordJob(Theme::instance()->appName(), this); const auto job = new QKeychain::ReadPasswordJob(Theme::instance()->appName(), this);
job->setKey(proxyPasswordKey); job->setKey(proxyPasswordKey);
connect(job, &QKeychain::Job::finished, this, [acc](const QKeychain::Job *const incomingJob) { connect(job, &QKeychain::Job::finished, this, [acc](const QKeychain::Job *const incomingJob) {