proxmox-login: pass body as &str to response()

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
Dietmar Maurer 2023-05-08 08:22:17 +02:00
parent be169e25ae
commit a41c8481e2

View File

@ -265,8 +265,8 @@ impl SecondFactorChallenge {
}
/// Deal with the API's response object to extract the ticket.
pub fn response(&self, body: &[u8]) -> Result<Authentication, ResponseError> {
let response: api::ApiResponse<api::CreateTicketResponse> = serde_json::from_slice(body)?;
pub fn response(&self, body: &str) -> Result<Authentication, ResponseError> {
let response: api::ApiResponse<api::CreateTicketResponse> = serde_json::from_str(body)?;
let response = response.data.ok_or("missing response data")?;
if response.username != self.userid {