auth check clean

This commit is contained in:
dal 2025-05-09 12:49:53 -06:00
parent 69faf4faf9
commit 8d89a23c30
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
2 changed files with 21 additions and 6 deletions

View File

@ -1,7 +1,7 @@
use anyhow::{Result};
use async_trait::async_trait;
use clap::Parser;
use inquire::{Confirm, Password, Text};
use inquire::{Confirm, Password, Text, PasswordDisplayMode};
use thiserror::Error;
use crate::utils::{
@ -274,9 +274,15 @@ async fn prompt_for_missing_credentials(
format!("Enter your API key (current: {obfuscated_api_key}):")
};
let api_key_input = Password::new(&prompt_message)
.without_confirmation()
.with_help_message("Your API key can be found in your Buster dashboard. Leave blank to keep the current key.")
let help_message = format!(
"Your API key can be found at {}/app/settings/api-keys. Leave blank to keep the current key.",
creds.url
);
let api_key_input = Text::new(&prompt_message)
// .without_confirmation() // Removed for Text input
// .with_display_mode(PasswordDisplayMode::Masked) // Removed for Text input
.with_help_message(&help_message)
.prompt()
.map_err(|e| AuthError::UserInputFailed(e.to_string()))?;
@ -291,6 +297,8 @@ async fn prompt_for_missing_credentials(
return Err(AuthError::MissingApiKey.into());
}
println!("\n");
Ok(())
}

View File

@ -96,7 +96,11 @@ pub async fn check_for_updates() {
(Err(e), _) => {
eprintln!(
"{}",
format!("Failed to parse current version ({}): {}", CURRENT_VERSION, e).yellow()
format!(
"Failed to parse current version ({}): {}",
CURRENT_VERSION, e
)
.yellow()
);
}
(_, Err(e)) => {
@ -111,4 +115,7 @@ pub async fn check_for_updates() {
);
}
}
}
println!("\n");
}