From: Olivier Goffart Date: Mon, 24 Jul 2017 10:00:29 +0000 (+0200) Subject: OAuth: clear refresh token when the server claim not to support oauth X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~704^2^2~15 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6ae88514d8fe875751300ebf5c746a4e7e8a9eb5;p=nextcloud-desktop.git OAuth: clear refresh token when the server claim not to support oauth Allow upgrade path when the server removes support for oauth Relates: https://github.com/owncloud/client/issues/5848#issuecomment-317353049 We also need to force the account to commit the config to the disk, otherwise we may not register we are no longer using owncloud and we risk sending the password as the token to the token refresh API call --- diff --git a/src/gui/creds/httpcredentialsgui.cpp b/src/gui/creds/httpcredentialsgui.cpp index fca457a1e..2ab2d0d30 100644 --- a/src/gui/creds/httpcredentialsgui.cpp +++ b/src/gui/creds/httpcredentialsgui.cpp @@ -120,6 +120,7 @@ void HttpCredentialsGui::showDialog() bool ok = dialog.exec(); if (ok) { _password = dialog.textValue(); + _refreshToken.clear(); _ready = true; persist(); } diff --git a/src/libsync/creds/httpcredentials.cpp b/src/libsync/creds/httpcredentials.cpp index 2ebb9f9a2..0f71f445e 100644 --- a/src/libsync/creds/httpcredentials.cpp +++ b/src/libsync/creds/httpcredentials.cpp @@ -397,6 +397,7 @@ void HttpCredentials::persist() _account->setCredentialSetting(QLatin1String(userC), _user); _account->setCredentialSetting(QLatin1String(isOAuthC), isUsingOAuth()); + _account->wantsAccountSaved(_account); // write cert WritePasswordJob *job = new WritePasswordJob(Theme::instance()->appName());