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 /src/gui/accountstate.cpp | |
parent | 8411df4afcf251290d183c49d09092ea3e5a67bd (diff) |
Correctly handle credential invalidation on start up
Fixes: #8901
Diffstat (limited to 'src/gui/accountstate.cpp')
-rw-r--r-- | src/gui/accountstate.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
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 *) |