From 6ae88514d8fe875751300ebf5c746a4e7e8a9eb5 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 24 Jul 2017 12:00:29 +0200 Subject: [PATCH] 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 --- src/gui/creds/httpcredentialsgui.cpp | 1 + src/libsync/creds/httpcredentials.cpp | 1 + 2 files changed, 2 insertions(+) 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()); -- 2.30.2