Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorErik Verbruggen <erik@verbruggen.consulting>2021-10-13 15:30:57 +0300
committerErik Verbruggen <Erik.Verbruggen@Me.com>2021-11-17 15:30:14 +0300
commit137a17335f1bafdddde918462de5f76e86ca5e53 (patch)
tree20051fcc67c307b5e8a1c292815b445497ca764b /src
parentc9f50a0d0ee5bf43f98d75979c6bbd374128de5f (diff)
Fix re-authenticating at startup when logged out before
Fixes #8924
Diffstat (limited to 'src')
-rw-r--r--src/gui/accountstate.cpp24
-rw-r--r--src/gui/accountstate.h4
2 files changed, 24 insertions, 4 deletions
diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp
index fafa72f77..b50d3d424 100644
--- a/src/gui/accountstate.cpp
+++ b/src/gui/accountstate.cpp
@@ -28,6 +28,15 @@
#include <QTimer>
#include <qfontmetrics.h>
+namespace {
+
+inline const QLatin1String userExplicitlySignedOutC()
+{
+ return QLatin1String("userExplicitlySignedOut");
+}
+
+} // anonymous namespace
+
namespace OCC {
Q_LOGGING_CATEGORY(lcAccountState, "gui.account.state", QtInfoMsg)
@@ -112,14 +121,25 @@ AccountState::~AccountState()
{
}
-AccountState *AccountState::loadFromSettings(AccountPtr account, QSettings & /*settings*/)
+AccountState *AccountState::loadFromSettings(AccountPtr account, const QSettings &settings)
{
auto accountState = new AccountState(account);
+ const bool userExplicitlySignedOut = settings.value(userExplicitlySignedOutC(), false).toBool();
+ if (userExplicitlySignedOut) {
+ // see writeToSettings below
+ accountState->_state = SignedOut;
+ }
return accountState;
}
-void AccountState::writeToSettings(QSettings & /*settings*/)
+void AccountState::writeToSettings(QSettings &settings) const
{
+ // The SignedOut state is the only state where the client should *not* ask for credentials, nor
+ // try to connect to the server. All other states should transition to Connected by either
+ // (re-)trying to make a connection, or by authenticating (AskCredentials). So we save the
+ // SignedOut state to indicate that the client should not try to re-connect the next time it
+ // is started.
+ settings.setValue(userExplicitlySignedOutC(), _state == SignedOut);
}
AccountPtr AccountState::account() const
diff --git a/src/gui/accountstate.h b/src/gui/accountstate.h
index f2525410c..792e474b1 100644
--- a/src/gui/accountstate.h
+++ b/src/gui/accountstate.h
@@ -85,13 +85,13 @@ public:
*
* Use from AccountManager with a prepared QSettings object only.
*/
- static AccountState *loadFromSettings(AccountPtr account, QSettings &settings);
+ static AccountState *loadFromSettings(AccountPtr account, const QSettings &settings);
/** Writes account state information to settings.
*
* It does not write the Account data.
*/
- void writeToSettings(QSettings &settings);
+ void writeToSettings(QSettings &settings) const;
AccountPtr account() const;