From 628957de21d5e03e29182d21b9fa8a0f85f164cb Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Sun, 30 Aug 2015 12:08:40 +0200 Subject: [PATCH] Remove the _readPwdFromDeprecatedPlace codepath This was introduced in 1.6.2 to read the password from earlier versions. People upgrading from 1.5 to 2.1 will sadly need to re-enter their password. --- src/libsync/creds/httpcredentials.cpp | 56 +++++++++------------------ src/libsync/creds/httpcredentials.h | 1 - 2 files changed, 19 insertions(+), 38 deletions(-) diff --git a/src/libsync/creds/httpcredentials.cpp b/src/libsync/creds/httpcredentials.cpp index ba2c6e44c..32c4745e9 100644 --- a/src/libsync/creds/httpcredentials.cpp +++ b/src/libsync/creds/httpcredentials.cpp @@ -87,8 +87,7 @@ HttpCredentials::HttpCredentials() _certificatePath(), _certificatePasswd(), _ready(false), - _fetchJobInProgress(false), - _readPwdFromDeprecatedPlace(false) + _fetchJobInProgress(false) { } @@ -236,7 +235,6 @@ void HttpCredentials::fetch() connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*))); job->start(); _fetchJobInProgress = true; - _readPwdFromDeprecatedPlace = true; } } bool HttpCredentials::stillValid(QNetworkReply *reply) @@ -268,42 +266,26 @@ void HttpCredentials::slotReadJobDone(QKeychain::Job *job) // error happend. // In all error conditions it should // ask the user for the password interactively now. - if( _readPwdFromDeprecatedPlace ) { - // there simply was not a password. Lets restart a read job without - // a settings object as we did it in older client releases. - ReadPasswordJob *job = new ReadPasswordJob(Theme::instance()->appName()); - - const QString kck = keychainKey(_account->url().toString(), _user); - job->setKey(kck); - - connect(job, SIGNAL(finished(QKeychain::Job*)), SLOT(slotReadJobDone(QKeychain::Job*))); - job->start(); - _readPwdFromDeprecatedPlace = false; // do try that only once. - _fetchJobInProgress = true; - // Note: if this read job succeeds, the value from the old place is still - // NOT persisted into the new account. + // interactive password dialog starts here + + QString hint; + if (job->error() != EntryNotFound) { + hint = tr("Reading from keychain failed with error: '%1'").arg( + job->errorString()); + } + + bool ok; + QString pwd = queryPassword(&ok, hint); + _fetchJobInProgress = false; + if (ok) { + _password = pwd; + _ready = true; + persist(); } else { - // interactive password dialog starts here - - QString hint; - if (job->error() != EntryNotFound) { - hint = tr("Reading from keychain failed with error: '%1'").arg( - job->errorString()); - } - - bool ok; - QString pwd = queryPassword(&ok, hint); - _fetchJobInProgress = false; - if (ok) { - _password = pwd; - _ready = true; - persist(); - } else { - _password = QString::null; - _ready = false; - } - emit fetched(); + _password = QString::null; + _ready = false; } + emit fetched(); } } diff --git a/src/libsync/creds/httpcredentials.h b/src/libsync/creds/httpcredentials.h index 95c6ba460..14674a92c 100644 --- a/src/libsync/creds/httpcredentials.h +++ b/src/libsync/creds/httpcredentials.h @@ -74,7 +74,6 @@ private: QString _certificatePasswd; bool _ready; bool _fetchJobInProgress; //True if the keychain job is in progress or the input dialog visible - bool _readPwdFromDeprecatedPlace; }; } // namespace OCC -- 2.30.2