From 1580197229ce01ebdc6a655d2f5b67ca4b32da88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Mon, 11 Mar 2013 16:07:13 -0300 Subject: Auto login after the first run wizard if registered a new user Also add pyxdg as a dep --- pkg/requirements.pip | 3 ++- src/leap/gui/mainwindow.py | 8 +++++++- src/leap/gui/wizard.py | 6 ++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pkg/requirements.pip b/pkg/requirements.pip index 797c4e96..d5d655e4 100644 --- a/pkg/requirements.pip +++ b/pkg/requirements.pip @@ -5,4 +5,5 @@ jsonschema requests srp>=1.0.2 pyopenssl -keyring \ No newline at end of file +keyring +pyxdg diff --git a/src/leap/gui/mainwindow.py b/src/leap/gui/mainwindow.py index 4e6bb5fe..78ff9101 100644 --- a/src/leap/gui/mainwindow.py +++ b/src/leap/gui/mainwindow.py @@ -198,9 +198,14 @@ class MainWindow(QtGui.QMainWindow): self.show() if self._wizard: possible_username = self._wizard.get_username() + possible_password = self._wizard.get_password() if possible_username is not None: self.ui.lnUser.setText(possible_username) self._focus_password() + if possible_password is not None: + self.ui.lnPassword.setText(possible_password) + self.ui.chkRemember.setChecked(True) + self._login() self._wizard = None else: settings = QtCore.QSettings() @@ -214,7 +219,8 @@ class MainWindow(QtGui.QMainWindow): saved_password = keyring.get_password(self.KEYRING_KEY, saved_user .encode("utf8")) - self.ui.lnPassword.setText(saved_password.decode("utf8")) + if saved_password is not None: + self.ui.lnPassword.setText(saved_password.decode("utf8")) # Only automatically login if there is a saved user self.ui.chkAutoLogin.setChecked(auto_login) diff --git a/src/leap/gui/wizard.py b/src/leap/gui/wizard.py index 72e791b3..f8a1f833 100644 --- a/src/leap/gui/wizard.py +++ b/src/leap/gui/wizard.py @@ -111,12 +111,16 @@ class Wizard(QtGui.QWizard): self._register) self._username = None + self._password = None self._checker_thread = checker def get_username(self): return self._username + def get_password(self): + return self._password + def _enable_check(self, text): self.ui.btnCheck.setEnabled(len(self.ui.lnProvider.text()) != 0) @@ -186,6 +190,7 @@ class Wizard(QtGui.QWizard): username.encode("utf8"), password.encode("utf8"))]) self._username = username + self._password = password self._set_register_status(self.tr("Starting registration...")) else: self.ui.btnRegister.setEnabled(True) @@ -199,6 +204,7 @@ class Wizard(QtGui.QWizard): self.button(QtGui.QWizard.BackButton).setEnabled(False) else: self._username = None + self._password = None error_msg = self.tr("Unknown error") try: error_msg = req.json().get("errors").get("login")[0] -- cgit v1.2.3