Improve code style

This commit is contained in:
Kevin Yue authored and Kevin Yue committed 2024-04-07 20:31:05 +08:00
1 parent a884c41813
commit 9f085e8b8c
3 files changed
+14 -15

No files matched your search

+7 -10
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> {