Make empty password hash static

This commit is contained in:
Raphaël Thériault 2020-01-15 15:18:37 -05:00
parent 11c5e2f384
commit 8da71eb0df
1 changed files with 5 additions and 1 deletions

View File

@ -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
async fn auth(
identity: Identity,
@ -32,7 +36,7 @@ async fn auth(
return Ok(());
}
if password_hash == setup::hash("").as_slice() {
if password_hash == (&*EMPTY_HASH).as_slice() {
identity.remember("guest".into());
return Ok(());
}