fix: exit if no password is provided when needed

This commit is contained in:
thomasv 2013-01-02 13:39:50 +01:00
parent 9bf31f4d71
commit accbf7ea82
1 changed files with 13 additions and 7 deletions

View File

@ -378,13 +378,19 @@ if __name__ == '__main__':
# commands needing password
if cmd in protected_commands or ( cmd=='addresses' and options.show_keys):
password = prompt_password('Password:', False) if wallet.use_encryption and not is_temporary else None
# check password
try:
wallet.pw_decode( wallet.seed, password)
except:
print_msg("Error: This password does not decode this wallet.")
exit(1)
if wallet.use_encryption and not is_temporary:
password = prompt_password('Password:', False)
if not password:
print_msg("Error: Password required")
exit(1)
# check password
try:
wallet.pw_decode( wallet.seed, password)
except:
print_msg("Error: This password does not decode this wallet.")
exit(1)
else:
password = None
if cmd == 'import':
# See if they specificed a key on the cmd line, if not prompt