aboutsummaryrefslogtreecommitdiffstats
path: root/src/args.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/args.rs')
-rw-r--r--src/args.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/args.rs b/src/args.rs
index 63799a0..d37e429 100644
--- a/src/args.rs
+++ b/src/args.rs
@@ -3,7 +3,7 @@ use std::path::PathBuf;
use structopt::StructOpt;
use crate::auth;
-use crate::errors::{ContextualError};
+use crate::errors::ContextualError;
use crate::themes;
/// Possible characters for random routes
@@ -98,15 +98,13 @@ fn parse_auth(src: &str) -> Result<auth::RequiredAuth, ContextualError> {
let hash_bin = if let Ok(hash_bin) = hex::decode(hash_hex) {
hash_bin
} else {
- return Err(ContextualError::InvalidPasswordHash)
+ return Err(ContextualError::InvalidPasswordHash);
};
match second_part {
"sha256" => auth::RequiredAuthPassword::Sha256(hash_bin.to_owned()),
"sha512" => auth::RequiredAuthPassword::Sha512(hash_bin.to_owned()),
- _ => {
- return Err(ContextualError::InvalidHashMethod(second_part.to_owned()))
- },
+ _ => return Err(ContextualError::InvalidHashMethod(second_part.to_owned())),
}
} else {
// To make it Windows-compatible, the password needs to be shorter than 255 characters.
@@ -185,7 +183,10 @@ mod tests {
}
#[rstest_parametrize(
- auth_string, username, password, encrypt,
+ auth_string,
+ username,
+ password,
+ encrypt,
case("username:password", "username", "password", "plain"),
case("username:sha256:abcd", "username", "abcd", "sha256"),
case("username:sha512:abcd", "username", "abcd", "sha512")
@@ -205,7 +206,7 @@ mod tests {
),
case(
"username:blahblah:abcd",
- "blahblah is not a valid hashing method. Expected sha256 or sha512"
+ "Invalid hashing method blahblah. Expected sha256 or sha512"
),
case(
"username:sha256:invalid",