From: Christian Kamm Date: Thu, 7 Sep 2017 09:10:23 +0000 (+0200) Subject: Http credentials: Fix behavior for bad password #5989 X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~701^2~124 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=359184927925d28a2678b2dc0ab75a0d5f9d0779;p=nextcloud-desktop.git Http credentials: Fix behavior for bad password #5989 When the GET request from askFromUser is scheduled on the QNAM inside the slot that handles the QNetworkReply::finished signal, it seems to not get processed at all. This workaround moves the sending of the new GET to the event loop, sidestepping the problem. --- diff --git a/src/gui/creds/httpcredentialsgui.cpp b/src/gui/creds/httpcredentialsgui.cpp index 2ab2d0d30..e65554f49 100644 --- a/src/gui/creds/httpcredentialsgui.cpp +++ b/src/gui/creds/httpcredentialsgui.cpp @@ -30,6 +30,14 @@ using namespace QKeychain; namespace OCC { void HttpCredentialsGui::askFromUser() +{ + // Unfortunately there's a bug that doesn't allow us to send the "is this + // OAuth2 or Basic auth?" GET request directly. Scheduling it for the event + // loop works though. See #5989. + QMetaObject::invokeMethod(this, "askFromUserAsync", Qt::QueuedConnection); +} + +void HttpCredentialsGui::askFromUserAsync() { _password = QString(); // So our QNAM does not add any auth diff --git a/src/gui/creds/httpcredentialsgui.h b/src/gui/creds/httpcredentialsgui.h index fefc4dd1d..94ebda152 100644 --- a/src/gui/creds/httpcredentialsgui.h +++ b/src/gui/creds/httpcredentialsgui.h @@ -48,7 +48,7 @@ public: * This will query the server and either uses OAuth via _asyncAuth->start() * or call showDialog to ask the password */ - Q_INVOKABLE void askFromUser() Q_DECL_OVERRIDE; + void askFromUser() Q_DECL_OVERRIDE; /** * In case of oauth, return an URL to the link to open the browser. * An invalid URL otherwise @@ -65,6 +65,8 @@ signals: void authorisationLinkChanged(); private: + Q_INVOKABLE void askFromUserAsync(); + QScopedPointer> _asyncAuth; };