[Pkg-owncloud-commits] [owncloud-client] 02/27: HTTP Creds: In case of Keychain error, open the interact password dialog

Sandro Knauß hefee-guest at moszumanska.debian.org
Tue Jul 29 16:23:57 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 88f26fb5489fd8c8d06f7d5d43b1785773eed278
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Wed Jul 2 16:24:50 2014 +0200

    HTTP Creds: In case of Keychain error, open the interact password dialog
    
    But in case the user clicks cancel in the interactive dialog, invalidate
    the credentials. Emit fechted() also in error case.
---
 src/creds/httpcredentials.cpp | 60 ++++++++++++++++++++++---------------------
 1 file changed, 31 insertions(+), 29 deletions(-)

diff --git a/src/creds/httpcredentials.cpp b/src/creds/httpcredentials.cpp
index 18d0602..81899a2 100644
--- a/src/creds/httpcredentials.cpp
+++ b/src/creds/httpcredentials.cpp
@@ -263,37 +263,39 @@ void HttpCredentials::slotReadJobDone(QKeychain::Job *job)
         _ready = true;
         emit fetched();
     } else {
-
-        if( _password.isEmpty() || error == EntryNotFound ) {
-            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->setProperty("account", QVariant::fromValue(account));
-                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.
+        // we come here if the password is empty or any other keychain
+        // 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->setProperty("account", QVariant::fromValue(account));
+            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.
+        } else {
+            // interactive password dialog starts here
+            bool ok;
+            QString pwd = queryPassword(&ok);
+            _fetchJobInProgress = false;
+            if (ok) {
+                _password = pwd;
+                _ready = true;
+                persist(account);
             } else {
-
-                bool ok;
-                QString pwd = queryPassword(&ok);
-                _fetchJobInProgress = false;
-                if (ok) {
-                    _password = pwd;
-                    _ready = true;
-                    persist(account);
-                }
-                emit fetched();
+                _password = QString::null;
+                _ready = false;
             }
-        } else {
-            qDebug() << "Error while reading password" << job->errorString();
+            emit fetched();
         }
     }
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list