From f745288f4ddf49e72604709f3c1eb75e47b3b369 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Wed, 8 Apr 2015 16:03:22 -0300 Subject: [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 --- src/leap/bitmask/gui/login.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') 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) -- cgit v1.2.3