mirror of
https://github.com/borgbase/vorta
synced 2025-01-03 13:45:49 +00:00
Improve kwallet verification. By @samuel-w (#889)
This commit is contained in:
parent
8da81e73b6
commit
46c3eee9a4
1 changed files with 5 additions and 2 deletions
|
@ -20,7 +20,7 @@ def __init__(self):
|
||||||
self.object_path,
|
self.object_path,
|
||||||
self.interface_name,
|
self.interface_name,
|
||||||
QtDBus.QDBusConnection.sessionBus())
|
QtDBus.QDBusConnection.sessionBus())
|
||||||
if not (self.iface.isValid() and self.get_result("isEnabled")):
|
if not (self.iface.isValid() and self.get_result("isEnabled") is True):
|
||||||
raise KWalletNotAvailableException
|
raise KWalletNotAvailableException
|
||||||
|
|
||||||
def set_password(self, service, repo_url, password):
|
def set_password(self, service, repo_url, password):
|
||||||
|
@ -49,7 +49,10 @@ def try_unlock(self):
|
||||||
wId = QVariant(0)
|
wId = QVariant(0)
|
||||||
wId.convert(4)
|
wId.convert(4)
|
||||||
output = self.get_result("open", args=[wallet_name, wId, 'vorta-repo'])
|
output = self.get_result("open", args=[wallet_name, wId, 'vorta-repo'])
|
||||||
self.handle = int(output)
|
try:
|
||||||
|
self.handle = int(output)
|
||||||
|
except ValueError: # For when kwallet is disabled or dbus otherwise broken
|
||||||
|
return -2
|
||||||
|
|
||||||
|
|
||||||
class KWalletNotAvailableException(Exception):
|
class KWalletNotAvailableException(Exception):
|
||||||
|
|
Loading…
Reference in a new issue