From aa969cdbc9d8d0c77b0fa0e2c72164e8cb816c87 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Tue, 19 Nov 2013 17:08:22 -0300 Subject: Disable EIP if need login before to be usable. --- src/leap/bitmask/gui/mainwindow.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index b0f25af1..9074df2b 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -366,6 +366,7 @@ class MainWindow(QtGui.QMainWindow): # if we don't have any provider configured (included a pinned # one) we can't use the application, so quit. self.quit() + self.eip_needs_login.emit() else: self._finish_init() @@ -574,6 +575,9 @@ class MainWindow(QtGui.QMainWindow): if possible_password is not None: self._login_widget.set_password(possible_password) self._login() + else: + self.eip_needs_login.emit() + self._wizard = None else: self._try_autostart_eip() -- cgit v1.2.3 From 307bf9e5512d3e2037078b5722f9f9c8879e5446 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Tue, 19 Nov 2013 17:13:38 -0300 Subject: Remove unused execution path. --- src/leap/bitmask/gui/mainwindow.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 9074df2b..ac73e08b 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -358,17 +358,17 @@ class MainWindow(QtGui.QMainWindow): Called if the wizard has been cancelled or closed before finishing. + This is executed for the first run wizard only. Any other execution of + the wizard won't reach this point. """ - if self._wizard_firstrun: - providers = self._settings.get_configured_providers() - has_provider_on_disk = len(providers) != 0 - if not has_provider_on_disk: - # if we don't have any provider configured (included a pinned - # one) we can't use the application, so quit. - self.quit() - self.eip_needs_login.emit() - else: - self._finish_init() + providers = self._settings.get_configured_providers() + has_provider_on_disk = len(providers) != 0 + if not has_provider_on_disk: + # if we don't have any provider configured (included a pinned + # one) we can't use the application, so quit. + self.quit() + + self.eip_needs_login.emit() def _launch_wizard(self): """ @@ -539,8 +539,7 @@ class MainWindow(QtGui.QMainWindow): TRIGGERS: self._wizard.accepted - Also called at the end of the constructor if not first run, - and after _rejected_wizard if not first run. + Also called at the end of the constructor if not first run. Implements the behavior after either constructing the mainwindow object, loading the saved user/password, or after -- cgit v1.2.3 From f174d94e00b0619c4f5dfde769e76209823702a3 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Tue, 19 Nov 2013 17:30:41 -0300 Subject: Add providers even if the wizard is rejected. --- src/leap/bitmask/gui/mainwindow.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index ac73e08b..ce4290a4 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -367,8 +367,11 @@ class MainWindow(QtGui.QMainWindow): # if we don't have any provider configured (included a pinned # one) we can't use the application, so quit. self.quit() - - self.eip_needs_login.emit() + else: + # This happens if the user finishes the provider + # setup but does not register + self._wizard = None + self._finish_init() def _launch_wizard(self): """ -- cgit v1.2.3 From f95df925f7640537e301442a6faabbcdd282f130 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Wed, 20 Nov 2013 11:55:36 -0300 Subject: Disable the EIP start if EIP is disabled. --- src/leap/bitmask/gui/mainwindow.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index ce4290a4..6a1f4445 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -1455,6 +1455,7 @@ class MainWindow(QtGui.QMainWindow): self.tr("Not supported"), error=True) else: + self._eip_status.disable_eip_start() self._eip_status.set_eip_status(self.tr("Disabled")) def _finish_eip_bootstrap(self, data): -- cgit v1.2.3 From d0a19caef10e9437b9b389764bfa50f2bb1575ac Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Wed, 20 Nov 2013 11:57:22 -0300 Subject: Remove unused import. --- src/leap/bitmask/gui/mainwindow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index 6a1f4445..e21d6cd2 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -22,7 +22,7 @@ import os from PySide import QtCore, QtGui from twisted.internet import threads -from zope.proxy import ProxyBase, setProxiedObject, sameProxiedObjects +from zope.proxy import ProxyBase, setProxiedObject from leap.bitmask import __version__ as VERSION from leap.bitmask.config.leapsettings import LeapSettings -- cgit v1.2.3 From d1d724092d9eab606114dbf2aab8a9a0ad0e0e09 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 21 Nov 2013 10:16:12 -0300 Subject: Disable eip-config for uninitialized providers. - Show the user which provider has not been initialized and disable its usage. - Add support for absolute path in get_eipconfig_path. - Replace hadr-coded paths with get_eipconfig_path. --- src/leap/bitmask/gui/eip_preferenceswindow.py | 35 ++++++++++++++++++++------- src/leap/bitmask/services/eip/eipconfig.py | 14 ++++++++--- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/leap/bitmask/gui/eip_preferenceswindow.py b/src/leap/bitmask/gui/eip_preferenceswindow.py index e0c5d51f..504d1cf1 100644 --- a/src/leap/bitmask/gui/eip_preferenceswindow.py +++ b/src/leap/bitmask/gui/eip_preferenceswindow.py @@ -28,6 +28,7 @@ from leap.bitmask.config.leapsettings import LeapSettings from leap.bitmask.config.providerconfig import ProviderConfig from leap.bitmask.gui.ui_eippreferences import Ui_EIPPreferences from leap.bitmask.services.eip.eipconfig import EIPConfig, VPNGatewaySelector +from leap.bitmask.services.eip.eipconfig import get_eipconfig_path logger = logging.getLogger(__name__) @@ -52,7 +53,7 @@ class EIPPreferencesWindow(QtGui.QDialog): self.ui.lblProvidersGatewayStatus.setVisible(False) # Connections - self.ui.cbProvidersGateway.currentIndexChanged[unicode].connect( + self.ui.cbProvidersGateway.currentIndexChanged[int].connect( self._populate_gateways) self.ui.cbGateways.currentIndexChanged[unicode].connect( @@ -93,7 +94,11 @@ class EIPPreferencesWindow(QtGui.QDialog): return for provider in providers: - self.ui.cbProvidersGateway.addItem(provider) + label = provider + eip_config_path = get_eipconfig_path(provider, relative=False) + if not os.path.isfile(eip_config_path): + label = provider + self.tr(" (uninitialized)") + self.ui.cbProvidersGateway.addItem(label, userData=provider) def _save_selected_gateway(self, provider): """ @@ -120,7 +125,7 @@ class EIPPreferencesWindow(QtGui.QDialog): "Gateway settings for provider '{0}' saved.").format(provider) self._set_providers_gateway_status(msg, success=True) - def _populate_gateways(self, domain): + def _populate_gateways(self, domain_idx): """ SLOT TRIGGERS: @@ -129,15 +134,29 @@ class EIPPreferencesWindow(QtGui.QDialog): Loads the gateways that the provider provides into the UI for the user to select. - :param domain: the domain of the provider to load gateways from. - :type domain: str + :param domain: the domain index of the provider to load gateways from. + :type domain: int """ # We hide the maybe-visible status label after a change self.ui.lblProvidersGatewayStatus.setVisible(False) - if not domain: + if domain_idx == -1: return + domain = self.ui.cbProvidersGateway.itemData(domain_idx) + + if not os.path.isfile(get_eipconfig_path(domain, relative=False)): + self._set_providers_gateway_status( + self.tr("This is an uninitialized provider, " + "please log in first."), + error=True) + self.ui.pbSaveGateway.setEnabled(False) + self.ui.cbGateways.setEnabled(False) + return + else: + self.ui.pbSaveGateway.setEnabled(True) + self.ui.cbGateways.setEnabled(True) + try: # disconnect previously connected save method self.ui.pbSaveGateway.clicked.disconnect() @@ -151,11 +170,9 @@ class EIPPreferencesWindow(QtGui.QDialog): eip_config = EIPConfig() provider_config = ProviderConfig.get_provider_config(domain) - eip_config_path = os.path.join("leap", "providers", - domain, "eip-service.json") api_version = provider_config.get_api_version() eip_config.set_api_version(api_version) - eip_loaded = eip_config.load(eip_config_path) + eip_loaded = eip_config.load(get_eipconfig_path(domain)) if not eip_loaded or provider_config is None: self._set_providers_gateway_status( diff --git a/src/leap/bitmask/services/eip/eipconfig.py b/src/leap/bitmask/services/eip/eipconfig.py index 16ed4cc0..09a3d257 100644 --- a/src/leap/bitmask/services/eip/eipconfig.py +++ b/src/leap/bitmask/services/eip/eipconfig.py @@ -33,17 +33,25 @@ from leap.common.check import leap_assert, leap_assert_type logger = logging.getLogger(__name__) -def get_eipconfig_path(domain): +def get_eipconfig_path(domain, relative=True): """ - Returns relative path for EIP config. + Returns relative or absolute path for EIP config. :param domain: the domain to which this eipconfig belongs to. :type domain: str + :param relative: defines whether the path should be relative or absolute. + :type relative: bool :returns: the path :rtype: str """ leap_assert(domain is not None, "get_eipconfig_path: We need a domain") - return os.path.join("leap", "providers", domain, "eip-service.json") + + path = os.path.join("leap", "providers", domain, "eip-service.json") + + if not relative: + path = os.path.join(get_path_prefix(), path) + + return path def load_eipconfig_if_needed(provider_config, eip_config, domain): -- cgit v1.2.3 From cecd69f72165518a3f1eae13547f34d3b824db7b Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 21 Nov 2013 10:19:27 -0300 Subject: Add changes file for #4523, #4555, #4422. --- changes/eip-disabled-until-usable | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 changes/eip-disabled-until-usable diff --git a/changes/eip-disabled-until-usable b/changes/eip-disabled-until-usable new file mode 100644 index 00000000..92c2c493 --- /dev/null +++ b/changes/eip-disabled-until-usable @@ -0,0 +1,7 @@ +- Disable Turn On EIP until we have an usable provider. Closes #4523. +- Load provider if the wizard was rejected and the setup was completed. +- Disable Turn On EIP if the "Encrypted Internet" service is disabled. + Closes #4555. +- If EIP service is disabled display 'Disabled' instead of 'You need to login + to use Encrypted Internet'. +- Disable eip-config until we have configured the provider. Closes #4422. -- cgit v1.2.3