mirror of https://github.com/raftario/filite.git
Make empty password hash static
This commit is contained in:
parent
11c5e2f384
commit
8da71eb0df
|
@ -22,6 +22,10 @@ fn parse_id(id: &str) -> Result<i32, HttpResponse> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
static ref EMPTY_HASH: Vec<u8> = setup::hash("");
|
||||||
|
}
|
||||||
|
|
||||||
/// Authenticates a user
|
/// Authenticates a user
|
||||||
async fn auth(
|
async fn auth(
|
||||||
identity: Identity,
|
identity: Identity,
|
||||||
|
@ -32,7 +36,7 @@ async fn auth(
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
if password_hash == setup::hash("").as_slice() {
|
if password_hash == (&*EMPTY_HASH).as_slice() {
|
||||||
identity.remember("guest".into());
|
identity.remember("guest".into());
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue