summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-03-11 16:07:13 -0300
committerTomás Touceda <chiiph@leap.se>2013-03-11 16:07:13 -0300
commit1580197229ce01ebdc6a655d2f5b67ca4b32da88 (patch)
tree4738c442e590671780cb99eddd3a21e53679b223 /src/leap
parent99e644bf4d941dfa430d21dba9ac99f138f5f7cc (diff)
Auto login after the first run wizard if registered a new user
Also add pyxdg as a dep
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/gui/mainwindow.py8
-rw-r--r--src/leap/gui/wizard.py6
2 files changed, 13 insertions, 1 deletions
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]