Skip to content

Commit b6767f1

Browse files
committed
fix: read password issue
1 parent 322510f commit b6767f1

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/services/auth.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use anyhow::Result;
2+
use std::io::{stdout, Write};
23
use tracing::{info, warn};
34

45
use crate::settings::SettingsStore;
@@ -16,13 +17,17 @@ pub trait CredentialsProvider {
1617
pub struct StdinCredentialsProvider;
1718
impl CredentialsProvider for StdinCredentialsProvider {
1819
fn read_password(&self) -> Result<Password> {
19-
print!("Enter your password (hidden): ");
20+
print!("\nEnter your password (hidden): ");
21+
let _ = stdout().flush();
2022
let password = Password::new(&rpassword::read_password()?)?;
23+
println!();
2124
Ok(password)
2225
}
2326
fn read_mfa_code(&self) -> Result<MfaCode> {
24-
print!("Enter your MFA code (hidden): ");
27+
print!("\nEnter your MFA code (hidden): ");
28+
let _ = stdout().flush();
2529
let mfa_code = MfaCode::new(&rpassword::read_password()?)?;
30+
println!();
2631
Ok(mfa_code)
2732
}
2833
}

0 commit comments

Comments
 (0)