diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2015-04-08 16:03:22 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2015-04-09 12:32:37 -0300 |
commit | f745288f4ddf49e72604709f3c1eb75e47b3b369 (patch) | |
tree | 68ac40615836a37d8c907c9ddddc8470ca20bbe0 /src/leap/bitmask/gui/login.py | |
parent | 99064b35ff90b71ce96e7533fe953fd669d8a41c (diff) |
[bug] handle user cancel keyring open operation
Catch the keyring.errors.InitError exception.
The automatic login sequence now stops correctly instead of freezing if
the user cancel the keyring open operation.
- Resolves: #6682
Diffstat (limited to 'src/leap/bitmask/gui/login.py')
-rw-r--r-- | src/leap/bitmask/gui/login.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/leap/bitmask/gui/login.py b/src/leap/bitmask/gui/login.py index 90df0b73..716a8609 100644 --- a/src/leap/bitmask/gui/login.py +++ b/src/leap/bitmask/gui/login.py @@ -32,6 +32,7 @@ The login sequence is the following: """ import logging +from keyring.errors import InitError as KeyringInitError from PySide import QtCore, QtGui from ui_login import Ui_LoginWidget @@ -365,6 +366,9 @@ class LoginWidget(QtGui.QWidget, SignalTracker): # Only save the username if it was saved correctly in # the keyring self._settings.set_user(full_user_id) + except KeyringInitError as e: + logger.error("Failed to unlock keyring, maybe the user " + "cancelled the operation {0!r}".format(e)) except Exception as e: logger.exception("Problem saving data to keyring. %r" % (e,)) @@ -653,6 +657,9 @@ class LoginWidget(QtGui.QWidget, SignalTracker): saved_password = keyring.get_password(self.KEYRING_KEY, u_user) except ValueError as e: logger.debug("Incorrect Password. %r." % (e,)) + except KeyringInitError as e: + logger.error("Failed to unlock keyring, maybe the user " + "cancelled the operation {0!r}".format(e)) if saved_password is not None: self.set_password(saved_password) |