summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2013-10-16 15:41:31 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2013-10-16 15:41:31 -0300
commit2a920d3b499c4a35d647c181eb596d041c2deead (patch)
treef8e3b80af31f188ab089d1eae5f4f1186fb1bdff
parent36c36bc9dc9fed643245c9c96a9840f06c515ec1 (diff)
Remember last domain used to login. Closes #4116.
-rw-r--r--changes/bug-4116_remember-last-login-domain1
-rw-r--r--src/leap/bitmask/config/leapsettings.py19
-rw-r--r--src/leap/bitmask/gui/login.py1
-rw-r--r--src/leap/bitmask/gui/mainwindow.py8
4 files changed, 26 insertions, 3 deletions
diff --git a/changes/bug-4116_remember-last-login-domain b/changes/bug-4116_remember-last-login-domain
new file mode 100644
index 00000000..9331052b
--- /dev/null
+++ b/changes/bug-4116_remember-last-login-domain
@@ -0,0 +1 @@
+ o Remember last domain used to login. Closes #4116.
diff --git a/src/leap/bitmask/config/leapsettings.py b/src/leap/bitmask/config/leapsettings.py
index d7b60ba9..c524425e 100644
--- a/src/leap/bitmask/config/leapsettings.py
+++ b/src/leap/bitmask/config/leapsettings.py
@@ -62,6 +62,7 @@ class LeapSettings(object):
GEOMETRY_KEY = "Geometry"
WINDOWSTATE_KEY = "WindowState"
USER_KEY = "User"
+ PROVIDER_KEY = "Provider"
REMEMBER_KEY = "RememberUserAndPass"
DEFAULTPROVIDER_KEY = "DefaultProvider"
AUTOSTARTEIP_KEY = "AutoStartEIP"
@@ -241,6 +242,24 @@ class LeapSettings(object):
leap_assert(len(user) > 0, "We cannot save an empty user")
self._settings.setValue(self.USER_KEY, user)
+ def get_provider(self):
+ """
+ Returns the configured provider to remember, None if there isn't one
+
+ :rtype: str or None
+ """
+ return self._settings.value(self.PROVIDER_KEY, None)
+
+ def set_provider(self, provider):
+ """
+ Saves the provider to remember
+
+ :param provider: provider name to remember
+ :type provider: str
+ """
+ leap_assert(len(provider) > 0, "We cannot save an empty provider")
+ self._settings.setValue(self.PROVIDER_KEY, provider)
+
def get_remember(self):
"""
Returns the value of the remember selection.
diff --git a/src/leap/bitmask/gui/login.py b/src/leap/bitmask/gui/login.py
index c8c5c402..ac34fe23 100644
--- a/src/leap/bitmask/gui/login.py
+++ b/src/leap/bitmask/gui/login.py
@@ -297,6 +297,7 @@ class LoginWidget(QtGui.QWidget):
self.set_enabled(False)
self.ui.clblErrorMsg.hide()
+ self._settings.set_provider(provider)
if self.get_remember() and has_keyring():
# in the keyring and in the settings
# we store the value 'usename@provider'
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index 5d7f717b..f5631c69 100644
--- a/src/leap/bitmask/gui/mainwindow.py
+++ b/src/leap/bitmask/gui/mainwindow.py
@@ -583,6 +583,11 @@ class MainWindow(QtGui.QMainWindow):
self._wizard = None
else:
self._try_autostart_eip()
+
+ domain = self._settings.get_provider()
+ if domain is not None:
+ self._login_widget.select_provider_by_name(domain)
+
if not self._settings.get_remember():
# nothing to do here
return
@@ -600,9 +605,6 @@ class MainWindow(QtGui.QMainWindow):
# fill the username
self._login_widget.set_user(username)
- # select the configured provider in the combo box
- self._login_widget.select_provider_by_name(domain)
-
self._login_widget.set_remember(True)
saved_password = None