Add password confirmation to encryption

If the user mistypes their password, they could end up losing data when it comes time to decrypt it elsewhere. This would ask them to confirm their initial entry to safeguard against that.
This commit is contained in:
Michael Parks 2014-06-26 11:16:51 -06:00
parent 8eeba1481d
commit 10570ec5dd

View file

@ -69,7 +69,14 @@ def install_jrnl(config_path='~/.jrnl_config'):
# Encrypt it?
if module_exists("Crypto"):
password = getpass.getpass("Enter password for journal (leave blank for no encryption): ")
confirmed_password = False
while confirmed_password == False:
password = getpass.getpass("Enter password for journal (leave blank for no encryption): ")
password_conf = getpass.getpass("Confirm password: ")
if password == password_conf:
confirmed_password = True
else:
print("Password and confirmation did not match, try again.")
if password:
default_config['encrypt'] = True
if util.yesno("Do you want to store the password in your keychain?", default=True):