chore: lints
This commit is contained in:
parent
5d49ecee5c
commit
458afd3577
2 changed files with 17 additions and 8 deletions
|
@ -13,9 +13,12 @@ pub struct LoginCommand {
|
|||
}
|
||||
|
||||
impl LoginCommand {
|
||||
pub fn new(_username: String, supplied_password: String, actual_password_hash: &str) -> IdentityCommandResult<Self> {
|
||||
let success =
|
||||
argon2_creds::Config::verify(actual_password_hash, &supplied_password)?;
|
||||
pub fn new(
|
||||
_username: String,
|
||||
supplied_password: String,
|
||||
actual_password_hash: &str,
|
||||
) -> IdentityCommandResult<Self> {
|
||||
let success = argon2_creds::Config::verify(actual_password_hash, &supplied_password)?;
|
||||
Ok(Self { success })
|
||||
}
|
||||
}
|
||||
|
@ -30,10 +33,14 @@ mod tests {
|
|||
let password = "adsfasdfasd";
|
||||
let hashed_password = config.password(password).unwrap();
|
||||
assert!(
|
||||
LoginCommand::new("realaravinth".into(), password.into(), &hashed_password,).unwrap().success
|
||||
LoginCommand::new("realaravinth".into(), password.into(), &hashed_password,)
|
||||
.unwrap()
|
||||
.success
|
||||
);
|
||||
assert!(
|
||||
!LoginCommand::new("realaravinth".into(), "password".into(), &hashed_password,).unwrap().success
|
||||
!LoginCommand::new("realaravinth".into(), "password".into(), &hashed_password,)
|
||||
.unwrap()
|
||||
.success
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,8 @@ mod tests {
|
|||
|
||||
{
|
||||
let cmd =
|
||||
command::LoginCommand::new(username.into(), password.into(), &hashed_password).unwrap();
|
||||
command::LoginCommand::new(username.into(), password.into(), &hashed_password)
|
||||
.unwrap();
|
||||
let res = s.login(cmd.clone()).await;
|
||||
assert_eq!(res.success(), cmd.success());
|
||||
}
|
||||
|
@ -40,7 +41,8 @@ mod tests {
|
|||
{
|
||||
// success=false:
|
||||
let cmd =
|
||||
command::LoginCommand::new(username.into(), "asdfasdf".into(), &hashed_password).unwrap();
|
||||
command::LoginCommand::new(username.into(), "asdfasdf".into(), &hashed_password)
|
||||
.unwrap();
|
||||
let res = s.login(cmd.clone()).await;
|
||||
assert_eq!(res.success(), cmd.success());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue