Ask password before cleaning screen

This commit is contained in:
ChristianVisintin
2020-12-09 16:17:11 +01:00
parent 8bd315ef37
commit 8f3e416144
2 changed files with 19 additions and 9 deletions

View File

@@ -1,10 +1,17 @@
# Changelog # Changelog
- [Changelog](#changelog) - [Changelog](#changelog)
- [0.1.1](#011)
- [0.1.0](#010) - [0.1.0](#010)
--- ---
## 0.1.1
Work in progress
- password prompt: ask before performing terminal clear
## 0.1.0 ## 0.1.0
Released on 06/12/2020 Released on 06/12/2020

View File

@@ -134,17 +134,9 @@ fn main() {
Ok(dir) => dir, Ok(dir) => dir,
Err(_) => PathBuf::from("/"), Err(_) => PathBuf::from("/"),
}; };
// Create activity manager
let mut manager: ActivityManager = match ActivityManager::new(&wrkdir, ticks) {
Ok(m) => m,
Err(_) => {
eprintln!("Invalid directory '{}'", wrkdir.display());
std::process::exit(255);
}
};
// Initialize client if necessary // Initialize client if necessary
let mut start_activity: NextActivity = NextActivity::Authentication; let mut start_activity: NextActivity = NextActivity::Authentication;
if let Some(address) = address { if address.is_some() {
if password.is_none() { if password.is_none() {
// Ask password if unspecified // Ask password if unspecified
password = match rpassword::read_password_from_tty(Some("Password: ")) { password = match rpassword::read_password_from_tty(Some("Password: ")) {
@@ -163,6 +155,17 @@ fn main() {
} }
// In this case the first activity will be FileTransfer // In this case the first activity will be FileTransfer
start_activity = NextActivity::FileTransfer; start_activity = NextActivity::FileTransfer;
}
// Create activity manager (and context too)
let mut manager: ActivityManager = match ActivityManager::new(&wrkdir, ticks) {
Ok(m) => m,
Err(_) => {
eprintln!("Invalid directory '{}'", wrkdir.display());
std::process::exit(255);
}
};
// Set file transfer params if set
if let Some(address) = address {
manager.set_filetransfer_params(address, port, protocol, username, password); manager.set_filetransfer_params(address, port, protocol, username, password);
} }
// Run // Run