awa
This commit is contained in:
@@ -972,7 +972,7 @@ pub(crate) async fn get_certificate(
|
||||
let token = path_parts[3];
|
||||
|
||||
let challenge: Option<(String, String, String, Option<String>, chrono::DateTime<chrono::Utc>)> = sqlx::query_as(
|
||||
"SELECT domain, challenge_type, verification_data, csr_pem, expires_at FROM certificate_challenges WHERE token = $1"
|
||||
"SELECT domain, challenge_type, verification_data, csr_pem, expires_at FROM certificate_challenges WHERE token = ?"
|
||||
)
|
||||
.bind(token)
|
||||
.fetch_optional(&app_state.db)
|
||||
@@ -984,14 +984,9 @@ pub(crate) async fn get_certificate(
|
||||
None => return Ok(GurtResponse::not_found().with_string_body("Challenge not found")),
|
||||
};
|
||||
|
||||
let csr_pem = match csr_pem {
|
||||
Some(csr) => csr,
|
||||
None => {
|
||||
return Ok(
|
||||
GurtResponse::bad_request().with_string_body("CSR not found for this challenge")
|
||||
)
|
||||
}
|
||||
};
|
||||
let csr_pem = csr_pem.ok_or_else(|| {
|
||||
GurtResponse::bad_request().with_string_body("CSR not found for this challenge")
|
||||
})?;
|
||||
|
||||
if chrono::Utc::now() > expires_at {
|
||||
return Ok(GurtResponse::bad_request().with_string_body("Challenge expired"));
|
||||
|
||||
Reference in New Issue
Block a user