From 2c68f3389dcfd3c0858f3da8e91327385f0aab3f Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Sun, 12 Jun 2022 22:01:35 -0400 Subject: [PATCH] fix not getting prompted interactively for encryption passkey --- src/main.rs | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index e4ff0cd..92fe153 100644 --- a/src/main.rs +++ b/src/main.rs @@ -206,6 +206,8 @@ fn run() -> anyhow::Result<()> { if upgraded { info!("Manifest auto-upgraded"); manifest.save()?; + } else { + debug!("Manifest is up to date"); } break; } @@ -376,7 +378,29 @@ fn run() -> anyhow::Result<()> { return Ok(()); } - let mut selected_accounts = get_selected_accounts(&matches, &mut manifest)?; + let mut selected_accounts: Vec>>; + loop { + match get_selected_accounts(&matches, &mut manifest) { + Ok(accounts) => { + selected_accounts = accounts; + break; + } + Err( + accountmanager::ManifestAccountLoadError::MissingPasskey + | accountmanager::ManifestAccountLoadError::IncorrectPasskey, + ) => { + if manifest.has_passkey() { + error!("Incorrect passkey"); + } + passkey = rpassword::prompt_password_stdout("Enter encryption passkey: ").ok(); + manifest.submit_passkey(passkey); + } + Err(e) => { + error!("Could not load accounts: {}", e); + return Err(e.into()); + } + } + } debug!( "selected accounts: {:?}",