From caadb236f39b4b6139a697eec57aa2796595422f Mon Sep 17 00:00:00 2001 From: cyBerta Date: Tue, 21 May 2019 11:54:20 +0200 Subject: * show error dialog if provider is misconfigured and has not allowed registration nor anonymous usage * always download provider.json, Use preseeded provider.json only to check if the client can connect with preseeded certificate. Keeps the provider.json updated if provider changes it's config * Tests for both cases --- .../java/se/leap/bitmaskclient/ProviderApiManager.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'app/src/production/java') diff --git a/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java b/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java index cdbe5f60..1372fc43 100644 --- a/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java +++ b/app/src/production/java/se/leap/bitmaskclient/ProviderApiManager.java @@ -43,6 +43,7 @@ import static se.leap.bitmaskclient.ProviderSetupFailedDialog.DOWNLOAD_ERRORS.ER import static se.leap.bitmaskclient.R.string.downloading_vpn_certificate_failed; import static se.leap.bitmaskclient.R.string.error_io_exception_user_message; import static se.leap.bitmaskclient.R.string.malformed_url; +import static se.leap.bitmaskclient.R.string.setup_error_text; import static se.leap.bitmaskclient.R.string.warning_corrupted_provider_cert; import static se.leap.bitmaskclient.R.string.warning_corrupted_provider_details; @@ -95,15 +96,18 @@ public class ProviderApiManager extends ProviderApiManagerBase { resetProviderDetails(provider); } - if (!provider.hasDefinition()) { - currentDownload = getAndSetProviderJson(provider); - } + currentDownload = getAndSetProviderJson(provider); if (provider.hasDefinition() || (currentDownload.containsKey(BROADCAST_RESULT_KEY) && currentDownload.getBoolean(BROADCAST_RESULT_KEY))) { - if (!provider.hasCaCert()) + if (!provider.hasCaCert()) { currentDownload = downloadCACert(provider); + } if (provider.hasCaCert() || (currentDownload.containsKey(BROADCAST_RESULT_KEY) && currentDownload.getBoolean(BROADCAST_RESULT_KEY))) { currentDownload = getAndSetEipServiceJson(provider); } + + if (provider.hasEIP() && !provider.allowsRegistered() && !provider.allowsAnonymous()) { + setErrorResult(currentDownload, setup_error_text, null); + } } return currentDownload; -- cgit v1.2.3