diff --git a/src/gui/connectionvalidator.cpp b/src/gui/connectionvalidator.cpp index ebe1c1af525f6..31467ec3f4bf0 100644 --- a/src/gui/connectionvalidator.cpp +++ b/src/gui/connectionvalidator.cpp @@ -221,13 +221,20 @@ void ConnectionValidator::slotAuthFailed(QNetworkReply *reply) stat = CredentialsWrong; } else if (reply->error() != QNetworkReply::NoError) { - _errors << job->errorStringParsingBody(); + QByteArray body; + _errors << job->errorStringParsingBody(&body); const int httpStatus = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (httpStatus == 503) { _errors.clear(); stat = ServiceUnavailable; + } else if (httpStatus == 403) { + const auto davException = job->errorStringParsingBodyException(body); + if (davException == QStringLiteral(R"(OCA\TermsOfService\TermsNotSignedException)")) { + qCInfo(lcConnectionValidator) << "The terms of service need to be signed"; + stat = NeedToSignTermsOfService; + } } } diff --git a/src/gui/owncloudsetupwizard.cpp b/src/gui/owncloudsetupwizard.cpp index 7f9a587d8d3f2..5ebe09f82c151 100644 --- a/src/gui/owncloudsetupwizard.cpp +++ b/src/gui/owncloudsetupwizard.cpp @@ -42,8 +42,6 @@ namespace OCC { -const auto termsNotSignedExceptionC = QStringLiteral("OCA\\TermsOfService\\TermsNotSignedException"); - OwncloudSetupWizard::OwncloudSetupWizard(QObject *parent) : QObject(parent) , _ocWizard(new OwncloudWizard) @@ -431,8 +429,9 @@ void OwncloudSetupWizard::slotAuthError() errorMsg = tr("Access forbidden by server. To verify that you have proper access, " "click here to access the service with your browser.") .arg(Utility::escape(_ocWizard->account()->url().toString())); - } else if (!davException.first.isEmpty() && davException.first == termsNotSignedExceptionC) { + } else if (!davException.first.isEmpty() && davException.first == QStringLiteral(R"(OCA\TermsOfService\TermsNotSignedException)")) { qCInfo(lcWizard) << "Terms of service not accepted yet!"; + // TODO: it would be cool to display a new wizard page containing the terms of service errorMsg = tr("Please accept the Terms of Service with your browser and try again.") .arg(Utility::escape(_ocWizard->account()->url().toString())); } else { diff --git a/src/gui/tray/syncstatussummary.cpp b/src/gui/tray/syncstatussummary.cpp index cd31daac96677..65aeae60aa61f 100644 --- a/src/gui/tray/syncstatussummary.cpp +++ b/src/gui/tray/syncstatussummary.cpp @@ -14,6 +14,7 @@ #include "syncstatussummary.h" #include "accountfwd.h" +#include "accountstate.h" #include "folderman.h" #include "navigationpanehelper.h" #include "networkjobs.h" @@ -124,6 +125,10 @@ void SyncStatusSummary::setSyncStateForFolder(const Folder *folder) setTotalFiles(0); setSyncStatusString(tr("Offline")); setSyncStatusDetailString(""); + if (_accountState->state() == AccountState::NeedToSignTermsOfService) + { + setSyncStatusDetailString(tr("You need to accept the terms of service")); + } setSyncIcon(Theme::instance()->folderOffline()); return; } @@ -340,6 +345,11 @@ void SyncStatusSummary::setSyncStateToConnectedState() setSyncStatusDetailString(""); if (_accountState && !_accountState->isConnected()) { setSyncStatusString(tr("Offline")); + // TODO: remove this, this is intentionally in caps to see that this is temporary + if (_accountState->state() == AccountState::NeedToSignTermsOfService) + { + setSyncStatusDetailString(tr("NEEDS TOS click here").arg(_accountState->account()->url().toString())); + } setSyncIcon(Theme::instance()->folderOffline()); } else { setSyncStatusString(tr("All synced!"));