login using encrypted data

This commit is contained in:
2025-09-23 11:53:44 +02:00
parent 30061f6988
commit 7b6b735b87

View File

@@ -254,13 +254,13 @@ pub async fn clean_auth_loging(
Err(_) => return (StatusCode::INTERNAL_SERVER_ERROR, "DB query error").into_response(),
};
let (user_id, stored_password, hotel_id, displayname) = match user_row {
let (user_id, stored_hash, hotel_id, displayname) = match user_row {
Some(u) => u,
None => return (StatusCode::UNAUTHORIZED, "Invalid credentials").into_response(),
};
};
if payload.password != stored_password {
return (StatusCode::UNAUTHORIZED, "Invalid credentials").into_response();
if !verify_password(&payload.password, &stored_hash) {
return (StatusCode::UNAUTHORIZED, "Invelid credentials").into_response();
}
let expiration = chrono::Utc::now()