Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
cli: improve passphrase input experience
Archived fintohaps opened 2 years ago

When an incorrect passphrase is entered, the characters are not removed. Unfortunately, this is due to the upstream library we are using[0].

To improve the experience, however, the with_display_toggle_enabled can be used to reveal the user’s input using the Ctrl+R hotkey. They can then reveal the password, if able to, and fix the problematic input.

Once the feature request in the upstream library is made, that can be used instead.

1 file changed +2 -1 0581c017 06aa51ab
modified radicle-term/src/io.rs
@@ -222,9 +222,10 @@ pub fn passphrase<V: validator::StringValidator + 'static>(
    validate: V,
) -> Result<Passphrase, inquire::InquireError> {
    Ok(Passphrase::from(
-
        Password::new("Passphrase:")
+
        Password::new("Passphrase (use Ctrl+R to reveal input):")
            .with_render_config(*CONFIG)
            .with_display_mode(inquire::PasswordDisplayMode::Masked)
+
            .with_display_toggle_enabled()
            .without_confirmation()
            .with_validator(validate)
            .prompt()?,