From 7481e43116995d744d485655b1de6494d771227e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= Date: Thu, 16 May 2019 19:28:14 +0200 Subject: [PATCH] SMTP: Store correct password into the password manager The configuration ties the SMTP account with the IMAP account (in terms of per-profile access), so it was wrong to use the default account name. This fixes a rare configuration where the user is: - using a non-default profile, - requires SMTP auth, - *and* uses a different set of credentials for SMTP access compared to IMAP. Change-Id: Id6d341d14bf795943d8f3b7b42fac587a062141d --- src/Gui/ComposeWidget.cpp | 4 ---- src/Gui/SettingsDialog.cpp | 4 +++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Gui/ComposeWidget.cpp b/src/Gui/ComposeWidget.cpp index 104d2790..9fb3192a 100644 --- a/src/Gui/ComposeWidget.cpp +++ b/src/Gui/ComposeWidget.cpp @@ -660,10 +660,6 @@ void ComposeWidget::passwordRequested(const QString &user, const QString &host) return; } - // FIXME: use another account-id at some point in future - // we are now using the profile to avoid overwriting passwords of - // other profiles in secure storage - // 'account-0' is the hardcoded value when not using a profile Plugins::PasswordJob *job = password->requestPassword(m_submission->accountId(), QStringLiteral("smtp")); if (!job) { askPassword(user, host); diff --git a/src/Gui/SettingsDialog.cpp b/src/Gui/SettingsDialog.cpp index a6e9b6b6..2eeb8b12 100644 --- a/src/Gui/SettingsDialog.cpp +++ b/src/Gui/SettingsDialog.cpp @@ -1078,7 +1078,9 @@ OutgoingPage::OutgoingPage(SettingsDialog *parent, QSettings &s): QScrollArea(pa connect(smtpBurl, &QAbstractButton::toggled, m_smtpAccountSettings, &MSA::Account::setUseBurl); connect(sendmail, &LineEdit::textEditingFinished, m_smtpAccountSettings, &MSA::Account::setPathToSendmail); - m_pwWatcher = new UiUtils::PasswordWatcher(this, m_parent->pluginManager(), QStringLiteral("account-0"), QStringLiteral("smtp")); + m_pwWatcher = new UiUtils::PasswordWatcher(this, m_parent->pluginManager(), + profileName.isEmpty() ? QStringLiteral("account-0") : profileName, + QStringLiteral("smtp")); connect(m_pwWatcher, &UiUtils::PasswordWatcher::stateChanged, this, &OutgoingPage::updateWidgets); connect(m_pwWatcher, &UiUtils::PasswordWatcher::savingFailed, this, &OutgoingPage::saved); connect(m_pwWatcher, &UiUtils::PasswordWatcher::savingDone, this, &OutgoingPage::saved); -- GitLab