From 7fa1f562499c49fea602ac4ea20bf4c032e1d022 Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Thu, 24 Mar 2022 11:17:03 +0100 Subject: Fix basic auth logout Fixes: #9545 --- changelog/unreleased/9545 | 5 +++++ src/gui/accountstate.cpp | 4 ++++ src/gui/creds/httpcredentialsgui.cpp | 2 ++ src/libsync/creds/abstractcredentials.h | 7 +++++++ 4 files changed, 18 insertions(+) create mode 100644 changelog/unreleased/9545 diff --git a/changelog/unreleased/9545 b/changelog/unreleased/9545 new file mode 100644 index 000000000..e7c3835f9 --- /dev/null +++ b/changelog/unreleased/9545 @@ -0,0 +1,5 @@ +Bugfix: Can't stop basic auth login + +We fixed a bug where the user was asked for their credentials again and again with no chance to abort. + +https://github.com/owncloud/client/issues/9545 diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index b04181a97..608d386d3 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -115,6 +115,10 @@ AccountState::AccountState(AccountPtr account) checkConnectivity(false); }, Qt::QueuedConnection); + + connect(account->credentials(), &AbstractCredentials::requestLogout, this, [this] { + _state = State::SignedOut; + }); } AccountState::~AccountState() diff --git a/src/gui/creds/httpcredentialsgui.cpp b/src/gui/creds/httpcredentialsgui.cpp index e035f1a09..3bf9d896b 100644 --- a/src/gui/creds/httpcredentialsgui.cpp +++ b/src/gui/creds/httpcredentialsgui.cpp @@ -151,6 +151,8 @@ void HttpCredentialsGui::showDialog() _refreshToken.clear(); _ready = true; persist(); + } else { + Q_EMIT requestLogout(); } emit asked(); }); diff --git a/src/libsync/creds/abstractcredentials.h b/src/libsync/creds/abstractcredentials.h index 8326f5d69..7218c10ed 100644 --- a/src/libsync/creds/abstractcredentials.h +++ b/src/libsync/creds/abstractcredentials.h @@ -106,6 +106,13 @@ Q_SIGNALS: void authenticationStarted(); void authenticationFailed(); + /* + * Request to log out. + * The connected account should be marked as logged out + * and no automatic tries to connect should be made. + */ + void requestLogout(); + protected: Account *_account; bool _wasFetched; -- cgit v1.2.3