From c34a123c2b05cad4cf113bb0aca1187514cc33b6 Mon Sep 17 00:00:00 2001 From: Olly Britton Date: Tue, 12 May 2020 12:04:52 +0100 Subject: [PATCH 1/3] ask for password before adding entry (#799) --- jrnl/cli.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/jrnl/cli.py b/jrnl/cli.py index 070d134bd..e2cb0f524 100644 --- a/jrnl/cli.py +++ b/jrnl/cli.py @@ -345,6 +345,13 @@ def run(manual_args=None): else: _exit_multiline_code = "press Ctrl+D" + # This is where we fi±nally open the journal! + try: + journal = open_journal(journal_name, config) + except KeyboardInterrupt: + print("[Interrupted while opening journal]", file=sys.stderr) + sys.exit(1) + if mode_compose and not args.text: if not sys.stdin.isatty(): # Piping data into jrnl @@ -376,13 +383,6 @@ def run(manual_args=None): else: sys.exit() - # This is where we finally open the journal! - try: - journal = open_journal(journal_name, config) - except KeyboardInterrupt: - print("[Interrupted while opening journal]", file=sys.stderr) - sys.exit(1) - # Import mode if mode_import: plugins.get_importer(args.import_).import_(journal, args.input) From 991c59b2e4eb9e57f9a7e2dcdddcf3549a36cf05 Mon Sep 17 00:00:00 2001 From: Olly Britton Date: Tue, 12 May 2020 12:04:52 +0100 Subject: [PATCH 2/3] ask for password before adding entry (#799) This fixes #799 because previously it would allow you to create an entry using your editor and then attempt to open the journal. This behaviour is fine for unencrypted journals but with encrypted journals it means that if you get the password wrong three times then the entry you just wrote is lost. Swapping the order around so that the entry is opened first in the code and then the editor is added means that this can't happen. --- jrnl/cli.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/jrnl/cli.py b/jrnl/cli.py index 070d134bd..e2cb0f524 100644 --- a/jrnl/cli.py +++ b/jrnl/cli.py @@ -345,6 +345,13 @@ def run(manual_args=None): else: _exit_multiline_code = "press Ctrl+D" + # This is where we fi±nally open the journal! + try: + journal = open_journal(journal_name, config) + except KeyboardInterrupt: + print("[Interrupted while opening journal]", file=sys.stderr) + sys.exit(1) + if mode_compose and not args.text: if not sys.stdin.isatty(): # Piping data into jrnl @@ -376,13 +383,6 @@ def run(manual_args=None): else: sys.exit() - # This is where we finally open the journal! - try: - journal = open_journal(journal_name, config) - except KeyboardInterrupt: - print("[Interrupted while opening journal]", file=sys.stderr) - sys.exit(1) - # Import mode if mode_import: plugins.get_importer(args.import_).import_(journal, args.input) From e9313ca3638366473c9e0d67cf8fdc9a90f19442 Mon Sep 17 00:00:00 2001 From: Olly Britton Date: Sat, 16 May 2020 19:50:56 +0100 Subject: [PATCH 3/3] fix typo in 'finally' --- jrnl/cli.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jrnl/cli.py b/jrnl/cli.py index e2cb0f524..148408d3c 100644 --- a/jrnl/cli.py +++ b/jrnl/cli.py @@ -345,7 +345,7 @@ def run(manual_args=None): else: _exit_multiline_code = "press Ctrl+D" - # This is where we fi±nally open the journal! + # This is where we finally open the journal! try: journal = open_journal(journal_name, config) except KeyboardInterrupt: