[Client] Stop sending the saved login when its checkbox is unticked (#7713)

Unticking 'Save password' only disabled auto-connect: the dialog still handed
the stored verifier to the connection, so a password typed at the same time was
ignored, and a server that still has the legacy hash refused the login before it
could upgrade the account.

Clear the verifier in effect on untick, restore it on re-tick unless a password
has been typed, and drop the stale 'Password saved' hint. The downgrade abort
can now point at unticking the box and logging in with the password, without the
extra reconnect round-trip.

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-11-04 07:06:35 +01:00 • committed by GitHub
parent 96f8c3a423
commit 99422c2bf0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 6 deletions

View file

@ -296,11 +296,13 @@ void DlgConnect::updateDisplayInfo(const QString &saveName)
playernameEdit->setFocus();
savePasswordCheckBox->setChecked(savePasswordStatus);
storedVerifier.clear();
savedVerifier.clear();
if (savePasswordStatus) {
const QString stored = _data.at(4);
if (stored.startsWith("$")) {
storedVerifier = stored;
savedVerifier = stored;
passwordEdit->clear();
passwordEdit->setPlaceholderText(tr("Password saved"));
} else {
@ -337,6 +339,7 @@ void DlgConnect::newHostSelected(bool state)
passwordEdit->clear();
passwordEdit->setPlaceholderText(QString());
storedVerifier.clear();
savedVerifier.clear();
saveEdit->clear();
saveEdit->setPlaceholderText(tr("Unique Server Name"));
saveEdit->setDisabled(false);
@ -352,9 +355,19 @@ void DlgConnect::passwordSaved(QT_STATE_CHANGED_T state)
Q_UNUSED(state);
if (savePasswordCheckBox->isChecked()) {
autoConnectCheckBox->setEnabled(true);
// Re-ticking keeps a password the user has started typing; otherwise restore the saved
// login this dialog was opened with, so unticking and changing your mind is harmless.
if (passwordEdit->text().isEmpty()) {
storedVerifier = savedVerifier;
passwordEdit->setPlaceholderText(savedVerifier.isEmpty() ? QString() : tr("Password saved"));
}
} else {
autoConnectCheckBox->setChecked(false);
autoConnectCheckBox->setEnabled(false);
// Unticking means the password typed below is sent for this connection: stop sending the
// saved verifier instead, and stop claiming a password is saved.
storedVerifier.clear();
passwordEdit->setPlaceholderText(QString());
}
}
@ -362,10 +375,11 @@ void DlgConnect::actOk()
{
ServersSettings &servers = SettingsCache::instance().servers();
// Never write a newly typed plaintext password to disk when a verifier is already stored:
// the typed value is used for this connection and a fresh verifier is persisted after a
// successful login. Without a stored verifier we keep the previous (plaintext legacy) behavior.
const QString passwordToSave = storedVerifier.isEmpty() ? passwordEdit->text() : storedVerifier;
// Never write a newly typed plaintext password to disk when a verifier is available: the
// typed value is used for this connection and a fresh verifier is persisted after a
// successful login. Without any verifier we keep the previous (plaintext legacy) behavior.
const QString verifierToSave = storedVerifier.isEmpty() ? savedVerifier : storedVerifier;
const QString passwordToSave = verifierToSave.isEmpty() ? passwordEdit->text() : verifierToSave;
if (newHostButton->isChecked()) {
if (saveEdit->text().isEmpty()) {