fix not getting prompted interactively for encryption passkey

This commit is contained in:
Carson McManus 2022-06-12 22:01:35 -04:00
parent 84e2712403
commit 2c68f3389d

View file

@ -206,6 +206,8 @@ fn run() -> anyhow::Result<()> {
if upgraded { if upgraded {
info!("Manifest auto-upgraded"); info!("Manifest auto-upgraded");
manifest.save()?; manifest.save()?;
} else {
debug!("Manifest is up to date");
} }
break; break;
} }
@ -376,7 +378,29 @@ fn run() -> anyhow::Result<()> {
return Ok(()); return Ok(());
} }
let mut selected_accounts = get_selected_accounts(&matches, &mut manifest)?; let mut selected_accounts: Vec<Arc<Mutex<SteamGuardAccount>>>;
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!( debug!(
"selected accounts: {:?}", "selected accounts: {:?}",