[Pkg-owncloud-commits] [owncloud-client] 117/164: Revert "SetupW: Display proper error messages if password or user was wrong."

Sandro Knauß hefee-guest at moszumanska.debian.org
Sun Mar 22 11:57:01 UTC 2015


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 c88742fad3424e87ca3204f149c550bfaabf2823
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Tue Mar 10 11:17:35 2015 +0100

    Revert "SetupW: Display proper error messages if password or user was wrong."
    
    This reverts commit 396f38598fa7f9e04adc4bd9a963fbd8f95a5161.
    
    This adds redundant code and potentially breaks Shibboleth
---
 src/gui/folderwizard.cpp              |  8 ++------
 src/gui/owncloudsetupwizard.cpp       | 21 +++++----------------
 src/libsync/connectionvalidator.cpp   |  8 +-------
 src/libsync/creds/httpcredentials.cpp |  7 ++++---
 src/libsync/networkjobs.cpp           | 25 +++++--------------------
 src/libsync/networkjobs.h             |  6 +-----
 6 files changed, 18 insertions(+), 57 deletions(-)

diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp
index 1160ca5..c1a583f 100644
--- a/src/gui/folderwizard.cpp
+++ b/src/gui/folderwizard.cpp
@@ -293,12 +293,8 @@ void FolderWizardRemotePath::slotCreateRemoteFolderFinished(QNetworkReply::Netwo
 void FolderWizardRemotePath::slotHandleNetworkError(QNetworkReply *reply)
 {
     qDebug() << "** webdav mkdir request failed:" << reply->error();
-    if( authenticationFailHappened(reply)) {
-        showWarn(tr("Authentication failed accessing %1").arg(Theme::instance()->appNameGUI()));
-    } else {
-        showWarn(tr("Failed to create the folder on %1. Please check manually.")
-                 .arg(Theme::instance()->appNameGUI()));
-    }
+    showWarn(tr("Failed to create the folder on %1. Please check manually.")
+             .arg(Theme::instance()->appNameGUI()));
 }
 
 static QTreeWidgetItem* findFirstChild(QTreeWidgetItem *parent, const QString& text)
diff --git a/src/gui/owncloudsetupwizard.cpp b/src/gui/owncloudsetupwizard.cpp
index 9cbdd20..13c3b55 100644
--- a/src/gui/owncloudsetupwizard.cpp
+++ b/src/gui/owncloudsetupwizard.cpp
@@ -245,27 +245,16 @@ bool OwncloudSetupWizard::checkDowngradeAdvised(QNetworkReply* reply)
 void OwncloudSetupWizard::slotConnectionCheck(QNetworkReply* reply)
 {
     QString msg = reply->errorString();
-    QNetworkReply::NetworkError err = reply->error();
-
-    // int errCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
-
-    switch (err) {
+    switch (reply->error()) {
     case QNetworkReply::NoError:
     case QNetworkReply::ContentNotFoundError:
         _ocWizard->successfulStep();
         break;
     default:
-        if( authenticationFailHappened(reply) ) {
-            // if the authentication fails, the request is canceled in HttpCredentials::slotAuthentication
-            // because of that, we need to check this here.
-            msg = tr("Credential Error: The entered username or password is wrong.");
-        } else {
-
-            if (!_ocWizard->account()->credentials()->stillValid(reply)) {
-                msg = tr("Access forbidden by server. To verify that you have proper access, "
-                         "<a href=\"%1\">click here</a> to access the service with your browser.")
-                        .arg(_ocWizard->account()->url().toString());
-            }
+        if (!_ocWizard->account()->credentials()->stillValid(reply)) {
+            msg = tr("Access forbidden by server. To verify that you have proper access, "
+                     "<a href=\"%1\">click here</a> to access the service with your browser.")
+                    .arg(_ocWizard->account()->url().toString());
         }
         _ocWizard->show();
         if (_ocWizard->currentId() == WizardCommon::Page_ShibbolethCreds) {
diff --git a/src/libsync/connectionvalidator.cpp b/src/libsync/connectionvalidator.cpp
index 51398c2..e586fb3 100644
--- a/src/libsync/connectionvalidator.cpp
+++ b/src/libsync/connectionvalidator.cpp
@@ -104,14 +104,8 @@ void ConnectionValidator::slotStatusFound(const QUrl&url, const QVariantMap &inf
 // status.php could not be loaded (network or server issue!).
 void ConnectionValidator::slotNoStatusFound(QNetworkReply *reply)
 {
-    if( authenticationFailHappened(reply) ) {
-        // it is an authentication problem, username and password are wrong.
-        // see HttpCredentials::slotAuthentication
-        _errors.append(tr("Authentication error: Either username or password are wrong."));
-    } else {
-        _errors.append( reply->errorString() );
-    }
     _errors.append(tr("Unable to connect to %1").arg(_account->url().toString()));
+    _errors.append( reply->errorString() );
     reportResult( StatusNotFound );
 }
 
diff --git a/src/libsync/creds/httpcredentials.cpp b/src/libsync/creds/httpcredentials.cpp
index 0d20226..92ef227 100644
--- a/src/libsync/creds/httpcredentials.cpp
+++ b/src/libsync/creds/httpcredentials.cpp
@@ -77,6 +77,7 @@ namespace
 const char userC[] = "user";
 const char certifPathC[] = "certificatePath";
 const char certifPasswdC[] = "certificatePasswd";
+const char authenticationFailedC[] = "owncloud-authentication-failed";
 } // ns
 
 class HttpCredentialsAccessManager : public AccessManager {
@@ -246,12 +247,12 @@ void HttpCredentials::fetch()
         _readPwdFromDeprecatedPlace = true;
     }
 }
-
 bool HttpCredentials::stillValid(QNetworkReply *reply)
 {
     return ((reply->error() != QNetworkReply::AuthenticationRequiredError)
             // returned if user or password is incorrect
-            && !authenticationFailHappened(reply));
+            && (reply->error() != QNetworkReply::OperationCanceledError
+                || !reply->property(authenticationFailedC).toBool()));
 }
 
 void HttpCredentials::slotReadJobDone(QKeychain::Job *job)
@@ -376,7 +377,7 @@ void HttpCredentials::slotAuthentication(QNetworkReply* reply, QAuthenticator* a
     // instead of utf8 encoding. Instead, we send it manually. Thus, if we reach this signal,
     // those credentials were invalid and we terminate.
     qDebug() << "Stop request: Authentication failed for " << reply->url().toString();
-    setAuthenticationFailed(reply);
+    reply->setProperty(authenticationFailedC, true);
     reply->close();
 }
 
diff --git a/src/libsync/networkjobs.cpp b/src/libsync/networkjobs.cpp
index afc9fac..8afb284 100644
--- a/src/libsync/networkjobs.cpp
+++ b/src/libsync/networkjobs.cpp
@@ -40,6 +40,7 @@ Q_DECLARE_METATYPE(QTimer*)
 
 namespace OCC {
 
+
 AbstractNetworkJob::AbstractNetworkJob(AccountPtr account, const QString &path, QObject *parent)
     : QObject(parent)
     , _duration(0)
@@ -152,15 +153,13 @@ void AbstractNetworkJob::slotFinished()
 {
     _timer.stop();
 
-    QNetworkReply::NetworkError error = _reply->error();
-
-    if( error == QNetworkReply::SslHandshakeFailedError ) {
+    if( _reply->error() == QNetworkReply::SslHandshakeFailedError ) {
         qDebug() << "SslHandshakeFailedError: " << reply()->errorString() << " : can be caused by a webserver wanting SSL client certificates";
     }
     
-    if( error != QNetworkReply::NoError ) {
-        qDebug() << Q_FUNC_INFO << error << _reply->errorString();
-        if (error == QNetworkReply::ProxyAuthenticationRequiredError) {
+    if( _reply->error() != QNetworkReply::NoError ) {
+        qDebug() << Q_FUNC_INFO << _reply->error() << _reply->errorString();
+        if (_reply->error() == QNetworkReply::ProxyAuthenticationRequiredError) {
             qDebug() << Q_FUNC_INFO << _reply->rawHeader("Proxy-Authenticate");
         }
         emit networkError(_reply);
@@ -495,20 +494,6 @@ bool LsColJob::finished()
 namespace {
 const char statusphpC[] = "status.php";
 const char owncloudDirC[] = "owncloud/";
-const char authenticationFailedC[] = "owncloud-authentication-failed";
-}
-
-bool authenticationFailHappened( QNetworkReply *reply )
-{
-    return ( reply && reply->error() == QNetworkReply::OperationCanceledError &&
-             reply->property(authenticationFailedC).toBool() );
-}
-
-void setAuthenticationFailed( QNetworkReply *reply)
-{
-    if( reply ) {
-        reply->setProperty(authenticationFailedC, true);
-    }
 }
 
 CheckServerJob::CheckServerJob(AccountPtr account, QObject *parent)
diff --git a/src/libsync/networkjobs.h b/src/libsync/networkjobs.h
index e082497..155e519 100644
--- a/src/libsync/networkjobs.h
+++ b/src/libsync/networkjobs.h
@@ -32,6 +32,7 @@ namespace OCC {
 
 class AbstractSslErrorHandler;
 
+
 /**
  * @brief Internal Helper class
  */
@@ -43,11 +44,6 @@ private:
     QPointer<QTimer> _timer;
 };
 
-
-bool OWNCLOUDSYNC_EXPORT authenticationFailHappened( QNetworkReply *reply );
-
-void setAuthenticationFailed( QNetworkReply *reply);
-
 /**
  * @brief The AbstractNetworkJob class
  */

-- 
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