Only allow empty passwords when forcing

This commit is contained in:
timvisee 2018-04-12 20:54:42 +02:00
parent d3f1288824
commit b8a03b89dd
No known key found for this signature in database
GPG key ID: 109CBA0BF74036C2
2 changed files with 12 additions and 8 deletions

View file

@ -1,9 +1,6 @@
# First release
- Implement `-f` flag for forcing
- Allow creating non existent directories with the `-f` flag
- Only allow file extension renaming on upload with `-f` flag
- Only allow empty passwords with `-f` flag
- Implement `-y` flag for assume yes
- Check for file expiry everywhere
- Soft limit uploads to 1GB and 2GB
- Remember all uploaded files, make files listable
@ -32,9 +29,6 @@
- Dotfile for default properties
- Host configuration file for host tags, to easily upload to other hosts
- Generate man pages
- Move API URL generator methods out of remote file class
- Prompt if a file download password is required
- Must use `-f` to overwrite existing file
- Rename host to server?
- Read and write files from and to stdin and stdout with `-` as file
- Ask to add MIME extension to downloaded files without one on Windows

View file

@ -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.