From 10570ec5dd008f1a651b995a8f6578a51f43e020 Mon Sep 17 00:00:00 2001 From: Michael Parks Date: Thu, 26 Jun 2014 11:16:51 -0600 Subject: [PATCH] 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. --- jrnl/install.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/jrnl/install.py b/jrnl/install.py index dcb83601..6f55d655 100644 --- a/jrnl/install.py +++ b/jrnl/install.py @@ -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):