3 files changed
+9
-3
Cargo.lock
+1
-2
@@ -140,8 +140,7 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
140
[[package]]
141
name = "dialoguer"
142
version = "0.10.3"
143
-source = "registry+https://github.com/rust-lang/crates.io-index"
144
-checksum = "af3c796f3b0b408d9fd581611b47fa850821fcb84aa640b83a3c1a5be2d691f2"
143
+source = "git+https://github.com/qt2/dialoguer.git?branch=password_validation#09e2ff16a4570bf6c250538ad244eff580245329"
144
dependencies = [
145
"console",
146
"shell-words",
Cargo.toml
+1
-1
@@ -17,7 +17,7 @@ path = "src/main.rs"
17
anyhow = "1.0.58"
18
clap = { version = "4.1.6", features = ["derive"] }
19
console = "0.15.0"
20
-dialoguer = "0.10.3"
20
+dialoguer = { git = "https://github.com/qt2/dialoguer.git", branch ="password_validation", package = "dialoguer" }
21
home = "0.5.4"
22
regex = "1.3.1"
23
reqwest = { version = "0.11", features = ["json"] }
src/main.rs
+7
@@ -132,6 +132,13 @@ async fn run() -> Result<CommandResult> {
132
.unwrap();
133
let password = Password::with_theme(&ColorfulTheme::default())
134
.with_prompt("Password")
135
+ .validate_with(|input: &String| -> Result<(), &str> {
136
+ if input.len() >= 6 {
137
+ Ok(())
138
+ } else {
139
+ Err("Password must be at least 6 characters")
140
+ }
141
+ })
142
.with_confirmation("Confirm password", "Passwords do not match")
143
.interact()
144
.unwrap();