diff --git a/src/routes.rs b/src/routes.rs index ce03ae5..c8e397f 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -22,6 +22,10 @@ fn parse_id(id: &str) -> Result { } } +lazy_static! { + static ref EMPTY_HASH: Vec = 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(()); }