Skip to content

Commit 70f1ff1

Browse files
committed
WIP
Signed-off-by: Jyrki Gadinger <[email protected]>
1 parent 2a3bdd5 commit 70f1ff1

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

src/gui/connectionvalidator.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,20 @@ void ConnectionValidator::slotAuthFailed(QNetworkReply *reply)
221221
stat = CredentialsWrong;
222222

223223
} else if (reply->error() != QNetworkReply::NoError) {
224-
_errors << job->errorStringParsingBody();
224+
QByteArray body;
225+
_errors << job->errorStringParsingBody(&body);
225226

226227
const int httpStatus =
227228
reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
228229
if (httpStatus == 503) {
229230
_errors.clear();
230231
stat = ServiceUnavailable;
232+
} else if (httpStatus == 403) {
233+
const auto davException = job->errorStringParsingBodyException(body);
234+
if (davException == QStringLiteral(R"(OCA\TermsOfService\TermsNotSignedException)")) {
235+
qCInfo(lcConnectionValidator) << "The terms of service need to be signed";
236+
stat = NeedToSignTermsOfService;
237+
}
231238
}
232239
}
233240

src/gui/owncloudsetupwizard.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242

4343
namespace OCC {
4444

45-
const auto termsNotSignedExceptionC = QStringLiteral("OCA\\TermsOfService\\TermsNotSignedException");
46-
4745
OwncloudSetupWizard::OwncloudSetupWizard(QObject *parent)
4846
: QObject(parent)
4947
, _ocWizard(new OwncloudWizard)
@@ -431,8 +429,9 @@ void OwncloudSetupWizard::slotAuthError()
431429
errorMsg = tr("Access forbidden by server. To verify that you have proper access, "
432430
"<a href=\"%1\">click here</a> to access the service with your browser.")
433431
.arg(Utility::escape(_ocWizard->account()->url().toString()));
434-
} else if (!davException.first.isEmpty() && davException.first == termsNotSignedExceptionC) {
432+
} else if (!davException.first.isEmpty() && davException.first == QStringLiteral(R"(OCA\TermsOfService\TermsNotSignedException)")) {
435433
qCInfo(lcWizard) << "Terms of service not accepted yet!";
434+
// TODO: it would be cool to display a new wizard page containing the terms of service
436435
errorMsg = tr("Please accept the <a href=\"%1\">Terms of Service</a> with your browser and try again.")
437436
.arg(Utility::escape(_ocWizard->account()->url().toString()));
438437
} else {

src/gui/tray/syncstatussummary.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "syncstatussummary.h"
1616
#include "accountfwd.h"
17+
#include "accountstate.h"
1718
#include "folderman.h"
1819
#include "navigationpanehelper.h"
1920
#include "networkjobs.h"
@@ -124,6 +125,10 @@ void SyncStatusSummary::setSyncStateForFolder(const Folder *folder)
124125
setTotalFiles(0);
125126
setSyncStatusString(tr("Offline"));
126127
setSyncStatusDetailString("");
128+
if (_accountState->state() == AccountState::NeedToSignTermsOfService)
129+
{
130+
setSyncStatusDetailString(tr("You need to accept the terms of service"));
131+
}
127132
setSyncIcon(Theme::instance()->folderOffline());
128133
return;
129134
}
@@ -340,6 +345,11 @@ void SyncStatusSummary::setSyncStateToConnectedState()
340345
setSyncStatusDetailString("");
341346
if (_accountState && !_accountState->isConnected()) {
342347
setSyncStatusString(tr("Offline"));
348+
// TODO: remove this, this is intentionally in caps to see that this is temporary
349+
if (_accountState->state() == AccountState::NeedToSignTermsOfService)
350+
{
351+
setSyncStatusDetailString(tr("NEEDS TOS <a href=\"%1\">click here</a>").arg(_accountState->account()->url().toString()));
352+
}
343353
setSyncIcon(Theme::instance()->folderOffline());
344354
} else {
345355
setSyncStatusString(tr("All synced!"));

0 commit comments

Comments
 (0)