update_progress doesn't work yet

This commit is contained in:
Martin Brodbeck 2023-09-26 15:32:55 +02:00
parent a671e79f1a
commit c870aa8c93

View file

@ -88,24 +88,9 @@ fn authorize(username: &str, password: &str) -> bool {
} }
async fn auth_user(headers: HeaderMap) -> StatusCode { async fn auth_user(headers: HeaderMap) -> StatusCode {
//let client = redis::Client::open("redis://127.0.0.1/").unwrap();
//let mut con = client.get_connection().unwrap();
let username = headers["x-auth-user"].to_str().unwrap_or(""); let username = headers["x-auth-user"].to_str().unwrap_or("");
let password = headers["x-auth-key"].to_str().unwrap_or(""); let password = headers["x-auth-key"].to_str().unwrap_or("");
/*if username.is_empty() || password.is_empty() {
return StatusCode::UNAUTHORIZED;
}
let user_key = format!("user:{username}:key");
let redis_pw: String = con.get(&user_key).unwrap();
if password != redis_pw {
return StatusCode::UNAUTHORIZED;
}*/
if authorize(&username, &password) == false { if authorize(&username, &password) == false {
return StatusCode::UNAUTHORIZED; return StatusCode::UNAUTHORIZED;
} }