diff options
author | Ivan Alejandro <ivanalejandro0@yahoo.com.ar> | 2013-05-22 11:13:31 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@yahoo.com.ar> | 2013-05-22 11:38:55 -0300 |
commit | 8c54836c146ac1870996b0d00e116332b9b3d0a5 (patch) | |
tree | 22d9186e756ced50ecf0777614b5563d02eee9e6 | |
parent | 0d8eb72fbe11dd9e5d59451fa4d49697213629cf (diff) |
Handle 'Incorrect Password' exception.
closes issue #2640.
don not automatic login if there is no password
add changes file
-rw-r--r-- | changes/bug-2640_app-crash-on-wrong-keyring-password | 1 | ||||
-rw-r--r-- | src/leap/gui/mainwindow.py | 15 |
2 files changed, 12 insertions, 4 deletions
diff --git a/changes/bug-2640_app-crash-on-wrong-keyring-password b/changes/bug-2640_app-crash-on-wrong-keyring-password new file mode 100644 index 00000000..eaee4f40 --- /dev/null +++ b/changes/bug-2640_app-crash-on-wrong-keyring-password @@ -0,0 +1 @@ + o Handle 'Incorrect Password' exception (keyring) diff --git a/src/leap/gui/mainwindow.py b/src/leap/gui/mainwindow.py index 7eb956cb..dad88362 100644 --- a/src/leap/gui/mainwindow.py +++ b/src/leap/gui/mainwindow.py @@ -354,15 +354,22 @@ class MainWindow(QtGui.QMainWindow): self.ui.chkRemember.setChecked(True) self.ui.chkAutoLogin.setEnabled(self.ui.chkRemember .isEnabled()) - saved_password = keyring.get_password(self.KEYRING_KEY, - saved_user - .encode("utf8")) + + saved_password = None + try: + saved_password = keyring.get_password(self.KEYRING_KEY, + saved_user + .encode("utf8")) + except ValueError, e: + logger.debug("Incorrect Password. %r." % (e,)) + if saved_password is not None: self.ui.lnPassword.setText(saved_password.decode("utf8")) # Only automatically login if there is a saved user + # and the password was retrieved right self.ui.chkAutoLogin.setChecked(auto_login) - if auto_login: + if auto_login and saved_password: self._login() def _show_systray(self): |