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

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralex-z <blackslayer4@gmail.com>2021-12-16 19:23:03 +0300
committeralex-z <blackslayer4@gmail.com>2022-01-05 11:01:13 +0300
commit62b0a9b9f17d6d531f9bd005de6a87c92f7ff8e1 (patch)
tree217c4c9d2606e647ce556c290e9044fa29b4cb14 /src
parentd790bafcadb458360552366e952be99472877cef (diff)
Try to sign-in after being signed-out due to SslHandshakeFailedError
Signed-off-by: alex-z <blackslayer4@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/accountstate.cpp15
-rw-r--r--src/gui/accountstate.h5
-rw-r--r--src/gui/application.cpp3
-rw-r--r--src/gui/connectionvalidator.cpp2
4 files changed, 24 insertions, 1 deletions
diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp
index 7521dac79..6100f70fc 100644
--- a/src/gui/accountstate.cpp
+++ b/src/gui/accountstate.cpp
@@ -221,6 +221,19 @@ void AccountState::setDesktopNotificationsAllowed(bool isAllowed)
emit desktopNotificationsAllowedChanged();
}
+AccountState::ConnectionStatus AccountState::lastConnectionStatus() const
+{
+ return _lastConnectionValidatorStatus;
+}
+
+void AccountState::trySignIn()
+{
+ if (isSignedOut() && account()) {
+ account()->resetRejectedCertificates();
+ signIn();
+ }
+}
+
void AccountState::checkConnectivity()
{
if (isSignedOut() || _waitingForNewCredentials) {
@@ -285,6 +298,8 @@ void AccountState::slotConnectionValidatorResult(ConnectionValidator::Status sta
return;
}
+ _lastConnectionValidatorStatus = status;
+
// Come online gradually from 503 or maintenance mode
if (status == ConnectionValidator::Connected
&& (_connectionStatus == ConnectionValidator::ServiceUnavailable
diff --git a/src/gui/accountstate.h b/src/gui/accountstate.h
index 7946e2f96..e2b0a927d 100644
--- a/src/gui/accountstate.h
+++ b/src/gui/accountstate.h
@@ -171,6 +171,10 @@ public:
*/
void setDesktopNotificationsAllowed(bool isAllowed);
+ ConnectionStatus lastConnectionStatus() const;
+
+ void trySignIn();
+
public slots:
/// Triggers a ping to the server to update state and
/// connection status and errors.
@@ -205,6 +209,7 @@ private:
AccountPtr _account;
State _state;
ConnectionStatus _connectionStatus;
+ ConnectionStatus _lastConnectionValidatorStatus = ConnectionStatus::Undefined;
QStringList _connectionErrors;
bool _waitingForNewCredentials;
QDateTime _timeOfLastETagCheck;
diff --git a/src/gui/application.cpp b/src/gui/application.cpp
index f153224b2..a7137743f 100644
--- a/src/gui/application.cpp
+++ b/src/gui/application.cpp
@@ -465,6 +465,9 @@ void Application::slotCheckConnection()
if (state != AccountState::SignedOut && state != AccountState::ConfigurationError
&& state != AccountState::AskingCredentials && !pushNotificationsAvailable) {
accountState->checkConnectivity();
+ } else if (state == AccountState::SignedOut && accountState->lastConnectionStatus() == AccountState::ConnectionStatus::SslError) {
+ qCWarning(lcApplication) << "Account is signed out due to SSL Handshake error. Going to perform a sign-in attempt...";
+ accountState->trySignIn();
}
}
diff --git a/src/gui/connectionvalidator.cpp b/src/gui/connectionvalidator.cpp
index 159333544..14bc2617c 100644
--- a/src/gui/connectionvalidator.cpp
+++ b/src/gui/connectionvalidator.cpp
@@ -136,7 +136,7 @@ void ConnectionValidator::slotStatusFound(const QUrl &url, const QJsonObject &in
void ConnectionValidator::slotNoStatusFound(QNetworkReply *reply)
{
auto job = qobject_cast<CheckServerJob *>(sender());
- qCWarning(lcConnectionValidator) << reply->error() << job->errorString() << reply->peek(1024);
+ qCWarning(lcConnectionValidator) << reply->error() << reply->errorString() << job->errorString() << reply->peek(1024);
if (reply->error() == QNetworkReply::SslHandshakeFailedError) {
reportResult(SslError);
return;