mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 19:48:31 +02:00
Add password confirmation to cli --encrypt
This commit is contained in:
parent
10570ec5dd
commit
1272e1395d
1 changed files with 8 additions and 1 deletions
|
@ -69,7 +69,14 @@ def guess_mode(args, config):
|
||||||
|
|
||||||
def encrypt(journal, filename=None):
|
def encrypt(journal, filename=None):
|
||||||
""" Encrypt into new file. If filename is not set, we encrypt the journal file itself. """
|
""" Encrypt into new file. If filename is not set, we encrypt the journal file itself. """
|
||||||
|
confirmed_password = False
|
||||||
|
while confirmed_password == False:
|
||||||
password = util.getpass("Enter new password: ")
|
password = util.getpass("Enter new password: ")
|
||||||
|
password_conf = util.getpass("Confirm password: ")
|
||||||
|
if password == password_conf:
|
||||||
|
confirmed_password = True
|
||||||
|
else:
|
||||||
|
print("Password and confirmation did not match, try again.")
|
||||||
journal.make_key(password)
|
journal.make_key(password)
|
||||||
journal.config['encrypt'] = True
|
journal.config['encrypt'] = True
|
||||||
journal.write(filename)
|
journal.write(filename)
|
||||||
|
|
Loading…
Add table
Reference in a new issue