auth: Remove auth bypass function

The authentication bypass function was mostly used for testing, before the
full flow was implemented.
Remove it now that it is no longer useful.
This commit is contained in:
trotFunky 2024-07-27 21:08:24 +01:00
parent 0c162d3b42
commit 120472354c

View file

@ -210,18 +210,3 @@ pub async fn logout(week: u8, mut db: Connection<Db>, cookies: &CookieJar<'_>) -
Redirect::to(uri!(week::week(week))) Redirect::to(uri!(week::week(week)))
} }
pub fn bypass_auth_debug(cookies: &CookieJar<'_>) {
if cookies.get_private("auth_token").is_some() {
return
}
let mut hasher = Blake2b512::new();
hasher.update(b"8");
hasher.update(SystemTime::now().duration_since(UNIX_EPOCH).expect("Non monotonous time event").as_secs().to_le_bytes());
let hash = hasher.finalize_fixed().to_ascii_lowercase();
let hash_str = String::from_utf8_lossy(hash.as_slice()).to_ascii_lowercase();
cookies.add_private(("auth_token", hash_str.clone()));
cookies.add_private(("auth_id", 8.to_string()));
println!("Generated hash string : {hash_str}");
}