OAuth: clear refresh token when the server claim not to support oauth
authorOlivier Goffart <ogoffart@woboq.com>
Mon, 24 Jul 2017 10:00:29 +0000 (12:00 +0200)
committerOlivier Goffart <olivier@woboq.com>
Tue, 25 Jul 2017 10:34:13 +0000 (12:34 +0200)
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

src/gui/creds/httpcredentialsgui.cpp
src/libsync/creds/httpcredentials.cpp

index fca457a1e9828c771c12a755f8d234d713875719..2ab2d0d30eb37afe7722178ff858385de893a928 100644 (file)
@@ -120,6 +120,7 @@ void HttpCredentialsGui::showDialog()
     bool ok = dialog.exec();
     if (ok) {
         _password = dialog.textValue();
+        _refreshToken.clear();
         _ready = true;
         persist();
     }
index 2ebb9f9a204dc25951b77b62f2979eacb31a78b3..0f71f445ee78ee96cf09c6f4445787590fb2a982 100644 (file)
@@ -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());