File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -221,13 +221,20 @@ void ConnectionValidator::slotAuthFailed(QNetworkReply *reply)
221
221
stat = CredentialsWrong;
222
222
223
223
} else if (reply->error () != QNetworkReply::NoError) {
224
- _errors << job->errorStringParsingBody ();
224
+ QByteArray body;
225
+ _errors << job->errorStringParsingBody (&body);
225
226
226
227
const int httpStatus =
227
228
reply->attribute (QNetworkRequest::HttpStatusCodeAttribute).toInt ();
228
229
if (httpStatus == 503 ) {
229
230
_errors.clear ();
230
231
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
+ }
231
238
}
232
239
}
233
240
Original file line number Diff line number Diff line change 42
42
43
43
namespace OCC {
44
44
45
- const auto termsNotSignedExceptionC = QStringLiteral(" OCA\\ TermsOfService\\ TermsNotSignedException" );
46
-
47
45
OwncloudSetupWizard::OwncloudSetupWizard (QObject *parent)
48
46
: QObject(parent)
49
47
, _ocWizard(new OwncloudWizard)
@@ -431,8 +429,9 @@ void OwncloudSetupWizard::slotAuthError()
431
429
errorMsg = tr (" Access forbidden by server. To verify that you have proper access, "
432
430
" <a href=\" %1\" >click here</a> to access the service with your browser." )
433
431
.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 )" ) ) {
435
433
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
436
435
errorMsg = tr (" Please accept the <a href=\" %1\" >Terms of Service</a> with your browser and try again." )
437
436
.arg (Utility::escape (_ocWizard->account ()->url ().toString ()));
438
437
} else {
Original file line number Diff line number Diff line change 14
14
15
15
#include " syncstatussummary.h"
16
16
#include " accountfwd.h"
17
+ #include " accountstate.h"
17
18
#include " folderman.h"
18
19
#include " navigationpanehelper.h"
19
20
#include " networkjobs.h"
@@ -124,6 +125,10 @@ void SyncStatusSummary::setSyncStateForFolder(const Folder *folder)
124
125
setTotalFiles (0 );
125
126
setSyncStatusString (tr (" Offline" ));
126
127
setSyncStatusDetailString (" " );
128
+ if (_accountState->state () == AccountState::NeedToSignTermsOfService)
129
+ {
130
+ setSyncStatusDetailString (tr (" You need to accept the terms of service" ));
131
+ }
127
132
setSyncIcon (Theme::instance ()->folderOffline ());
128
133
return ;
129
134
}
@@ -340,6 +345,11 @@ void SyncStatusSummary::setSyncStateToConnectedState()
340
345
setSyncStatusDetailString (" " );
341
346
if (_accountState && !_accountState->isConnected ()) {
342
347
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
+ }
343
353
setSyncIcon (Theme::instance ()->folderOffline ());
344
354
} else {
345
355
setSyncStatusString (tr (" All synced!" ));
You can’t perform that action at this time.
0 commit comments