From 67c873fd3b1c62c1ca101f35516f62718e1318a8 Mon Sep 17 00:00:00 2001 From: qkzk Date: Sun, 12 Nov 2023 16:26:08 +0100 Subject: better messages when asking a password --- src/constant_strings_paths.rs | 10 ++++++++-- src/mode.rs | 8 +++++--- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/constant_strings_paths.rs b/src/constant_strings_paths.rs index b8469ac..91909d3 100644 --- a/src/constant_strings_paths.rs +++ b/src/constant_strings_paths.rs @@ -111,8 +111,14 @@ pub const FILTER_LINES: [&str; 6] = [ "a: reset", ]; /// Password input presentation for the second window -pub const PASSWORD_LINES: [&str; 1] = - ["Type your password. It will be forgotten immediatly after use."]; +pub const PASSWORD_LINES_SUDO: [&str; 2] = [ + "Type your sudo password.", + "It will be forgotten immediatly after use.", +]; +pub const PASSWORD_LINES_DEVICE: [&str; 2] = [ + "Type the device passkey.", + "It will be forgotten immediatly after use.", +]; /// Shell presentation for the second window pub const SHELL_LINES: [&str; 11] = [ "Type a shell command", diff --git a/src/mode.rs b/src/mode.rs index e302f1f..e7076c2 100644 --- a/src/mode.rs +++ b/src/mode.rs @@ -2,8 +2,9 @@ use std::fmt; use crate::completion::InputCompleted; use crate::constant_strings_paths::{ - CHMOD_LINES, FILTER_LINES, NEWDIR_LINES, NEWFILE_LINES, NVIM_ADDRESS_LINES, PASSWORD_LINES, - REGEX_LINES, REMOTE_LINES, RENAME_LINES, SHELL_LINES, SORT_LINES, + CHMOD_LINES, FILTER_LINES, NEWDIR_LINES, NEWFILE_LINES, NVIM_ADDRESS_LINES, + PASSWORD_LINES_DEVICE, PASSWORD_LINES_SUDO, REGEX_LINES, REMOTE_LINES, RENAME_LINES, + SHELL_LINES, SORT_LINES, }; use crate::cryptsetup::BlockDeviceAction; use crate::password::{PasswordKind, PasswordUsage}; @@ -109,7 +110,8 @@ impl InputSimple { Self::Filter => &FILTER_LINES, Self::Newdir => &NEWDIR_LINES, Self::Newfile => &NEWFILE_LINES, - Self::Password(_, _, _) => &PASSWORD_LINES, + Self::Password(PasswordKind::SUDO, _, _) => &PASSWORD_LINES_SUDO, + Self::Password(PasswordKind::CRYPTSETUP, _, _) => &PASSWORD_LINES_DEVICE, Self::RegexMatch => ®EX_LINES, Self::Rename => &RENAME_LINES, Self::SetNvimAddr => &NVIM_ADDRESS_LINES, -- cgit v1.2.3