From 63b61bf6944ae493b3bf91e7461166bd601d7048 Mon Sep 17 00:00:00 2001 From: Holger Nahrstaedt <holger@nahrstaedt.de> Date: Fri, 27 Apr 2018 14:19:03 +0200 Subject: [PATCH] Improved unlock_wallet --- beem/cli.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/beem/cli.py b/beem/cli.py index 2223bc66..5253c377 100644 --- a/beem/cli.py +++ b/beem/cli.py @@ -81,7 +81,7 @@ def unlock_wallet(stm, password=None): password_storage = stm.config["password_storage"] if not password and KEYRING_AVAILABLE and password_storage == "keyring": password = keyring.get_password("beem", "wallet") - if not password and password_storage == "environment": + if not password and password_storage == "environment" and "UNLOCK" in os.environ: password = os.environ.get("UNLOCK") if bool(password): stm.wallet.unlock(password) @@ -93,7 +93,10 @@ def unlock_wallet(stm, password=None): if password_storage == "keyring" or password_storage == "environment": print("Wallet could not be unlocked with %s!" % password_storage) password = click.prompt("Password to unlock wallet", confirmation_prompt=False, hide_input=True) - unlock_wallet(stm, password=password) + if bool(password): + unlock_wallet(stm, password=password) + if not stm.wallet.locked(): + return True else: print("Wallet could not be unlocked!") return False -- GitLab