Output a more sensible error message for auth errors
authorKlaas Freitag <freitag@owncloud.com>
Tue, 10 Mar 2015 11:14:14 +0000 (12:14 +0100)
committerKlaas Freitag <freitag@owncloud.com>
Tue, 10 Mar 2015 11:14:14 +0000 (12:14 +0100)
src/gui/folderwizard.cpp
src/libsync/connectionvalidator.cpp

index c1a583f55e00d0f573f77fbdcce1f4a17e34000f..d676084895dda35cd5fbb1dd02b1544678488ebe 100644 (file)
@@ -19,6 +19,7 @@
 #include "networkjobs.h"
 #include "account.h"
 #include "selectivesyncdialog.h"
+#include "creds/abstractcredentials.h"
 
 #include <QDebug>
 #include <QDesktopServices>
@@ -293,8 +294,12 @@ void FolderWizardRemotePath::slotCreateRemoteFolderFinished(QNetworkReply::Netwo
 void FolderWizardRemotePath::slotHandleNetworkError(QNetworkReply *reply)
 {
     qDebug() << "** webdav mkdir request failed:" << reply->error();
-    showWarn(tr("Failed to create the folder on %1. Please check manually.")
-             .arg(Theme::instance()->appNameGUI()));
+    if( reply && !_account->credentials()->stillValid(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()));
+    }
 }
 
 static QTreeWidgetItem* findFirstChild(QTreeWidgetItem *parent, const QString& text)
index e586fb35dae9cf36c37e20618a66dfd62861aa62..b9da29f6bd69b9a9dea19afa88f4323ef9166af9 100644 (file)
@@ -104,8 +104,12 @@ void ConnectionValidator::slotStatusFound(const QUrl&url, const QVariantMap &inf
 // status.php could not be loaded (network or server issue!).
 void ConnectionValidator::slotNoStatusFound(QNetworkReply *reply)
 {
-    _errors.append(tr("Unable to connect to %1").arg(_account->url().toString()));
-    _errors.append( reply->errorString() );
+    if( reply && ! _account->credentials()->stillValid(reply)) {
+        _errors.append(tr("Authentication error: Either username or password are wrong."));
+    }  else {
+        _errors.append(tr("Unable to connect to %1").arg(_account->url().toString()));
+        _errors.append( reply->errorString() );
+    }
     reportResult( StatusNotFound );
 }