diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index 3133e22cd7590e3427a4f725f702a2f35d4c0b4a..0d1a102adb9ad6c8ce63354d6ea41e188b89693a 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -396,6 +396,9 @@ void AccountState::slotConnectionValidatorResult(ConnectionValidator::Status sta case ConnectionValidator::ServerVersionMismatch: setState(ConfigurationError); break; + case ConnectionValidator::ServerNotAllowed: + setState(ConfigurationError); + break; case ConnectionValidator::StatusNotFound: // This can happen either because the server does not exist // or because we are having network issues. The latter one is diff --git a/src/gui/connectionvalidator.cpp b/src/gui/connectionvalidator.cpp index f9b149787ed019c19fe9ebf0919ee38f682bc1fc..51f604f2226e5ef61c2794ce94fc434e5fac5bcc 100644 --- a/src/gui/connectionvalidator.cpp +++ b/src/gui/connectionvalidator.cpp @@ -50,6 +50,20 @@ void ConnectionValidator::checkServerAndAuth() reportResult(NotConfigured); return; } + + QString hostname = _account->url().host(); + if( + hostname.compare("nexttest.rma.ac.be", Qt::CaseInsensitive) != 0 + && hostname.compare("nextcloud.rma.ac.be", Qt::CaseInsensitive) != 0 + && hostname.compare("nextcloudtest.rma.ac.be", Qt::CaseInsensitive) != 0 + && hostname.compare("nextcloudval.rma.ac.be", Qt::CaseInsensitive) != 0 + ) + { + _errors << tr("The server ") << hostname << tr(" is forbidden by CDN rules."); + reportResult(ServerNotAllowed); + return; + } + qCDebug(lcConnectionValidator) << "Checking server and authentication"; _isCheckingServerAndAuth = true; diff --git a/src/gui/connectionvalidator.h b/src/gui/connectionvalidator.h index bd955d4128e67a4425828e2cf15b051b09890269..234e8f7fe1a433da36205f63fa33d26fc5afc4b5 100644 --- a/src/gui/connectionvalidator.h +++ b/src/gui/connectionvalidator.h @@ -93,6 +93,7 @@ public: StatusRedirect, // 204 URL received one of redirect HTTP codes (301-307), possibly a captive portal ServiceUnavailable, // 503 on authed request MaintenanceMode, // maintenance enabled in status.php + ServerNotAllowed, // Server is not whitelisted Timeout // actually also used for other errors on the authed request }; Q_ENUM(Status);