Improve code style

This commit is contained in:
Kevin Yue
2024-04-07 08:20:36 -04:00
committed by Kevin Yue
parent a884c41813
commit 9f085e8b8c
3 changed files with 14 additions and 15 deletions

View File

@@ -366,17 +366,14 @@ fn read_auth_data_from_html(html: &str) -> Result<SamlAuthData, AuthDataParseErr
return Err(AuthDataParseError::Invalid);
}
match SamlAuthData::from_html(html) {
Ok(auth_data) => Ok(auth_data),
Err(err) => {
if let Some(gpcallback) = extract_gpcallback(html) {
info!("Found gpcallback from html...");
SamlAuthData::from_gpcallback(&gpcallback)
} else {
Err(err)
}
SamlAuthData::from_html(html).or_else(|err| {
if let Some(gpcallback) = extract_gpcallback(html) {
info!("Found gpcallback from html...");
SamlAuthData::from_gpcallback(&gpcallback)
} else {
Err(err)
}
}
})
}
fn extract_gpcallback(html: &str) -> Option<String> {