From d3a4ce6d61051b168b39c13dad77c93e47e44a52 Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Wed, 18 Aug 2021 10:51:26 +0200 Subject: Correctly handle credential invalidation on start up Fixes: #8901 --- changelog/unreleased/8901 | 6 ++++++ src/gui/accountstate.cpp | 28 +++++++++++++--------------- 2 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 changelog/unreleased/8901 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(account()->credentials())) { - if (creds->refreshAccessToken()) - return; + _waitingForNewCredentials = true; + if (account()->credentials()->ready()) { + account()->credentials()->invalidateToken(); + } + if (auto creds = qobject_cast(account()->credentials())) { + if (creds->refreshAccessToken()) + return; + } + account()->credentials()->askFromUser(); } - account()->credentials()->askFromUser(); + setState(AskingCredentials); } void AccountState::slotCredentialsFetched(AbstractCredentials *) -- cgit v1.2.3