parent
4fb0e4cfcd
commit
04295dc742
5 changed files with 26 additions and 10 deletions
15
Cargo.lock
generated
15
Cargo.lock
generated
|
@ -2476,11 +2476,12 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rpassword"
|
||||
version = "5.0.1"
|
||||
version = "7.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ffc936cf8a7ea60c58f030fd36a612a48f440610214dc54bc36431f9ea0c3efb"
|
||||
checksum = "6678cf63ab3491898c0d021b493c94c9b221d91295294a2a5746eacbe5928322"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rtoolbox",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
|
@ -2506,6 +2507,16 @@ dependencies = [
|
|||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rtoolbox"
|
||||
version = "0.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "034e22c514f5c0cb8a10ff341b9b048b5ceb21591f31c8f44c43b960f9b3524a"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.23"
|
||||
|
|
|
@ -33,7 +33,7 @@ path = "src/main.rs"
|
|||
anyhow = "^1.0"
|
||||
base64 = "0.21.2"
|
||||
text_io = "0.1.8"
|
||||
rpassword = "5.0"
|
||||
rpassword = "7.2.0"
|
||||
reqwest = { version = "0.11", default-features = false, features = ["blocking", "json", "cookies", "gzip", "rustls-tls"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
|
|
@ -25,9 +25,8 @@ where
|
|||
error!("Passkey cannot be empty, try again.");
|
||||
continue;
|
||||
}
|
||||
let passkey_confirm =
|
||||
rpassword::prompt_password_stdout("Confirm encryption passkey: ")
|
||||
.map(SecretString::new)?;
|
||||
let passkey_confirm = rpassword::prompt_password("Confirm encryption passkey: ")
|
||||
.map(SecretString::new)?;
|
||||
if passkey1.expose_secret() == passkey_confirm.expose_secret() {
|
||||
passkey = Some(passkey1);
|
||||
break;
|
||||
|
|
|
@ -82,6 +82,7 @@ fn do_login_impl<T: Transport + Clone>(
|
|||
password: SecretString,
|
||||
account: Option<&SteamGuardAccount>,
|
||||
) -> anyhow::Result<Tokens> {
|
||||
debug!("starting login");
|
||||
let mut login = UserLogin::new(transport.clone(), build_device_details());
|
||||
|
||||
let mut password = password;
|
||||
|
|
13
src/tui.rs
13
src/tui.rs
|
@ -1,3 +1,4 @@
|
|||
use anyhow::Context;
|
||||
use crossterm::{
|
||||
cursor,
|
||||
event::{Event, KeyCode, KeyEvent, KeyModifiers},
|
||||
|
@ -6,6 +7,7 @@ use crossterm::{
|
|||
terminal::{Clear, ClearType, EnterAlternateScreen, LeaveAlternateScreen},
|
||||
QueueableCommand,
|
||||
};
|
||||
use log::debug;
|
||||
use secrecy::SecretString;
|
||||
use std::collections::HashSet;
|
||||
use std::io::{stderr, stdout, Write};
|
||||
|
@ -245,18 +247,21 @@ pub(crate) fn pause() {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn prompt_passkey() -> std::io::Result<SecretString> {
|
||||
pub(crate) fn prompt_passkey() -> anyhow::Result<SecretString> {
|
||||
debug!("prompting for passkey");
|
||||
loop {
|
||||
let raw = rpassword::prompt_password_stdout("Enter encryption passkey: ")?;
|
||||
let raw = rpassword::prompt_password("Enter encryption passkey: ")
|
||||
.context("prompting for passkey")?;
|
||||
if !raw.is_empty() {
|
||||
return Ok(SecretString::new(raw));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn prompt_password() -> std::io::Result<SecretString> {
|
||||
pub(crate) fn prompt_password() -> anyhow::Result<SecretString> {
|
||||
debug!("prompting for password");
|
||||
loop {
|
||||
let raw = rpassword::prompt_password_stdout("Password: ")?;
|
||||
let raw = rpassword::prompt_password("Password: ").context("prompting for password")?;
|
||||
if !raw.is_empty() {
|
||||
return Ok(SecretString::new(raw));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue