Remove the _readPwdFromDeprecatedPlace codepath
authorJocelyn Turcotte <jturcotte@woboq.com>
Sun, 30 Aug 2015 10:08:40 +0000 (12:08 +0200)
committerJocelyn Turcotte <jturcotte@woboq.com>
Tue, 1 Sep 2015 16:40:20 +0000 (18:40 +0200)
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
src/libsync/creds/httpcredentials.h

index ba2c6e44ca6e94fa4037fac99740e09cc84b4114..32c4745e9496dfbf1babc413286d4827c58f9e69 100644 (file)
@@ -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();
     }
 }
 
index 95c6ba4601b2764f50bc6cef9f31d77da87ba1d8..14674a92ccf7071ec03806041ad900d3560e06b8 100644 (file)
@@ -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