summaryrefslogtreecommitdiff
path: root/src/leap
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-06-11 14:48:44 -0300
committerTomás Touceda <chiiph@leap.se>2013-06-11 14:48:44 -0300
commitb72785e419c2fae2e6c51b9a865692681f03ab67 (patch)
tree767e3b469c19ed145c0153314fab5f90c375265a /src/leap
parent10a90ca6cc52c41fbd8987007b8f12317a3d8b8b (diff)
parent3e4ccef05a02c7b717b392acbb6201b2f8858a91 (diff)
Merge remote-tracking branch 'ivan/bug/2755_remember-provider' into develop
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/gui/mainwindow.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/leap/gui/mainwindow.py b/src/leap/gui/mainwindow.py
index ea5bca1a..d9fe478c 100644
--- a/src/leap/gui/mainwindow.py
+++ b/src/leap/gui/mainwindow.py
@@ -406,8 +406,21 @@ class MainWindow(QtGui.QMainWindow):
saved_user = self._settings.get_user()
auto_login = self._settings.get_autologin()
+ try:
+ username, domain = saved_user.split('@')
+ except (ValueError, AttributeError) as e:
+ # if the saved_user does not contain an '@' or its None
+ logger.error('Username@provider malformed. %r' % (e, ))
+ saved_user = None
+
if saved_user is not None:
- self.ui.lnUser.setText(saved_user)
+ # fill the username
+ self.ui.lnUser.setText(username)
+
+ # select the configured provider in the combo box
+ provider_index = self.ui.cmbProviders.findText(domain)
+ self.ui.cmbProviders.setCurrentIndex(provider_index)
+
self.ui.chkRemember.setChecked(True)
self.ui.chkAutoLogin.setEnabled(self.ui.chkRemember
.isEnabled())
@@ -693,13 +706,16 @@ class MainWindow(QtGui.QMainWindow):
self._login_set_enabled(False)
if self.ui.chkRemember.isChecked():
+ # in the keyring and in the settings
+ # we store the value 'usename@provider'
+ username_domain = (username + '@' + provider).encode("utf8")
try:
keyring.set_password(self.KEYRING_KEY,
- username.encode("utf8"),
+ username_domain,
password.encode("utf8"))
# Only save the username if it was saved correctly in
# the keyring
- self._settings.set_user(username)
+ self._settings.set_user(username_domain)
except Exception as e:
logger.error("Problem saving data to keyring. %r"
% (e,))