diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-08-18 11:51:26 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2021-08-18 13:48:17 +0300 |
commit | d3a4ce6d61051b168b39c13dad77c93e47e44a52 (patch) | |
tree | 5f8c5ce141f35afdc7450ac23c783cd14b0ff824 | |
parent | 8411df4afcf251290d183c49d09092ea3e5a67bd (diff) |
Correctly handle credential invalidation on start up
Fixes: #8901
-rw-r--r-- | changelog/unreleased/8901 | 6 | ||||
-rw-r--r-- | src/gui/accountstate.cpp | 28 |
2 files changed, 19 insertions, 15 deletions
diff --git a/changelog/unreleased/8901 b/changelog/unreleased/8901 new file mode 100644 index 000000000..9bfcddb93 --- /dev/null +++ b/changelog/unreleased/8901 @@ -0,0 +1,6 @@ +Bugfix: Start oauth/password prompt if password is wrong during start up + +If the oauth token was invalid during start up we didn't start the oauth process +and the user needed to manually log out in order to log in again. + +https://github.com/owncloud/client/issues/8901 diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index d2ae79394..cdab097f7 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -385,23 +385,21 @@ void AccountState::slotConnectionValidatorResult(ConnectionValidator::Status sta void AccountState::slotInvalidCredentials() { - if (isSignedOut() || _waitingForNewCredentials) - return; - - qCInfo(lcAccountState) << "Invalid credentials for" << _account->url().toString() - << "asking user"; + if (!_waitingForNewCredentials) { + qCInfo(lcAccountState) << "Invalid credentials for" << _account->url().toString() + << "asking user"; - _waitingForNewCredentials = true; - setState(AskingCredentials); - - if (account()->credentials()->ready()) { - account()->credentials()->invalidateToken(); - } - if (auto creds = qobject_cast<HttpCredentials *>(account()->credentials())) { - if (creds->refreshAccessToken()) - return; + _waitingForNewCredentials = true; + if (account()->credentials()->ready()) { + account()->credentials()->invalidateToken(); + } + if (auto creds = qobject_cast<HttpCredentials *>(account()->credentials())) { + if (creds->refreshAccessToken()) + return; + } + account()->credentials()->askFromUser(); } - account()->credentials()->askFromUser(); + setState(AskingCredentials); } void AccountState::slotCredentialsFetched(AbstractCredentials *) |