summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2014-08-11 14:21:46 -0300
committerTomás Touceda <chiiph@leap.se>2014-08-11 14:21:46 -0300
commit0046468367bd7cb1f1dd043bda46d9b9e2f4e30a (patch)
treeb6c193e92ba69a9b43e72e8ebfc0f88b602170a7
parente841a4b55abda36c3a9a1ca7c4072d9ac37e3fa4 (diff)
parentff4f8e1b1b0cbe48e8d94fed5128acc60be9bf1a (diff)
Merge remote-tracking branch 'refs/remotes/meskio/bug/wait-for-eip-to-autologin' into develop
-rw-r--r--changes/bug_5939_wait-for-eip-to-autologin1
-rw-r--r--src/leap/bitmask/gui/mainwindow.py51
2 files changed, 49 insertions, 3 deletions
diff --git a/changes/bug_5939_wait-for-eip-to-autologin b/changes/bug_5939_wait-for-eip-to-autologin
new file mode 100644
index 00000000..5dec8331
--- /dev/null
+++ b/changes/bug_5939_wait-for-eip-to-autologin
@@ -0,0 +1 @@
+- Wait until EIP is up to autologin. Closes #5939
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index 02488af1..02bad1d3 100644
--- a/src/leap/bitmask/gui/mainwindow.py
+++ b/src/leap/bitmask/gui/mainwindow.py
@@ -1159,12 +1159,14 @@ class MainWindow(QtGui.QMainWindow):
skip_first_run = self._settings.get_skip_first_run()
return not (has_provider_on_disk and skip_first_run)
+ @QtCore.Slot()
def _download_provider_config(self):
"""
Start the bootstrapping sequence. It will download the
provider configuration if it's not present, otherwise will
emit the corresponding signals inmediately
"""
+ self._disconnect_scheduled_login()
domain = self._login_widget.get_selected_provider()
self._backend.provider_setup(provider=domain)
@@ -1198,6 +1200,40 @@ class MainWindow(QtGui.QMainWindow):
self.tr("Unable to login: Problem with provider"))
self._login_widget.set_enabled(True)
+ def _schedule_login(self):
+ """
+ Schedule the login sequence to go after the EIP started.
+
+ The login sequence is connected to all finishing status of EIP
+ (connected, disconnected, aborted or died) to continue with the login
+ after EIP.
+ """
+ logger.debug('Login scheduled when eip_connected is triggered')
+ eip_sigs = self._eip_conductor.qtsigs
+ eip_sigs.connected_signal.connect(self._download_provider_config)
+ eip_sigs.disconnected_signal.connect(self._download_provider_config)
+ eip_sigs.connection_aborted_signal.connect(self._download_provider_config)
+ eip_sigs.connection_died_signal.connect(self._download_provider_config)
+
+ def _disconnect_scheduled_login(self):
+ """
+ Disconnect scheduled login signals if exists
+ """
+ try:
+ eip_sigs = self._eip_conductor.qtsigs
+ eip_sigs.connected_signal.disconnect(
+ self._download_provider_config)
+ eip_sigs.disconnected_signal.disconnect(
+ self._download_provider_config)
+ eip_sigs.connection_aborted_signal.disconnect(
+ self._download_provider_config)
+ eip_sigs.connection_died_signal.disconnect(
+ self._download_provider_config)
+ except Exception:
+ # signal not connected
+ pass
+
+
@QtCore.Slot()
def _login(self):
"""
@@ -1223,7 +1259,10 @@ class MainWindow(QtGui.QMainWindow):
else:
self.ui.action_create_new_account.setEnabled(False)
if self._login_widget.start_login():
- self._download_provider_config()
+ if self._trying_to_start_eip:
+ self._schedule_login()
+ else:
+ self._download_provider_config()
@QtCore.Slot(unicode)
def _authentication_error(self, msg):
@@ -1252,8 +1291,13 @@ class MainWindow(QtGui.QMainWindow):
Stop the login sequence.
"""
logger.debug("Cancelling log in.")
+ self._disconnect_scheduled_login()
+
self._cancel_ongoing_defers()
+ # Needed in case of EIP starting and login deferer never set
+ self._set_login_cancelled()
+
def _cancel_ongoing_defers(self):
"""
Cancel the running defers to avoid app blocking.
@@ -1667,8 +1711,9 @@ class MainWindow(QtGui.QMainWindow):
"""
passed = data[PASSED_KEY]
if not passed:
- self._login_widget.set_status(
- self.tr("Unable to connect: Problem with provider"))
+ self._eip_status.set_eip_status(
+ self.tr("Unable to connect: Problem with provider"),
+ error=True)
logger.error(data[ERROR_KEY])
self._already_started_eip = False
self._eip_status.aborted()