mirror of
https://github.com/timvisee/ffsend.git
synced 2025-10-06 02:29:57 +02:00
Only allow empty passwords when forcing
This commit is contained in:
parent
d3f1288824
commit
b8a03b89dd
2 changed files with 12 additions and 8 deletions
|
@ -103,13 +103,23 @@ pub fn prompt_password(main_matcher: &MainMatcher) -> String {
|
|||
quit_error(err_msg("Missing password, must be specified in no-interact mode").compat());
|
||||
}
|
||||
|
||||
// Prompt and return
|
||||
match prompt_password_stderr("Password: ") {
|
||||
// Prompt for the password
|
||||
let password = match prompt_password_stderr("Password: ") {
|
||||
Ok(password) => password,
|
||||
Err(err) => quit_error(err.context(
|
||||
"Failed to read password from password prompt"
|
||||
)),
|
||||
};
|
||||
|
||||
// Do not allow empty passwords unless forced
|
||||
if !main_matcher.force() && password.is_empty() {
|
||||
quit_error(err_msg("\
|
||||
An empty password is not supported by the web interface, \
|
||||
use '-f' to force\
|
||||
").compat())
|
||||
}
|
||||
|
||||
password
|
||||
}
|
||||
|
||||
/// Get a password if required.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue