From 8d89a23c30a7c145b1c8e90167c3eed88f4cbf3a Mon Sep 17 00:00:00 2001 From: dal Date: Fri, 9 May 2025 12:49:53 -0600 Subject: [PATCH] auth check clean --- cli/cli/src/commands/auth.rs | 16 ++++++++++++---- cli/cli/src/utils/updater.rs | 11 +++++++++-- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/cli/cli/src/commands/auth.rs b/cli/cli/src/commands/auth.rs index 5600a337d..602e124c5 100644 --- a/cli/cli/src/commands/auth.rs +++ b/cli/cli/src/commands/auth.rs @@ -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(()) } diff --git a/cli/cli/src/utils/updater.rs b/cli/cli/src/utils/updater.rs index ee880f6b1..aeeb3f348 100644 --- a/cli/cli/src/utils/updater.rs +++ b/cli/cli/src/utils/updater.rs @@ -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() { ); } } -} \ No newline at end of file + + println!("\n"); + +}