Compare commits

...

2 Commits

Author SHA1 Message Date
Kevin Yue
159673652c Refactor prelogin.rs to use default labels for username and password 2024-05-09 01:48:02 -04:00
Kevin Yue
200d13ef15 Release 2.2.1 2024-05-07 11:58:15 -04:00
4 changed files with 31 additions and 25 deletions

14
Cargo.lock generated
View File

@ -564,7 +564,7 @@ dependencies = [
[[package]]
name = "common"
version = "2.2.0"
version = "2.2.1"
dependencies = [
"is_executable",
]
@ -1430,7 +1430,7 @@ dependencies = [
[[package]]
name = "gpapi"
version = "2.2.0"
version = "2.2.1"
dependencies = [
"anyhow",
"base64 0.21.5",
@ -1462,7 +1462,7 @@ dependencies = [
[[package]]
name = "gpauth"
version = "2.2.0"
version = "2.2.1"
dependencies = [
"anyhow",
"clap",
@ -1483,7 +1483,7 @@ dependencies = [
[[package]]
name = "gpclient"
version = "2.2.0"
version = "2.2.1"
dependencies = [
"anyhow",
"clap",
@ -1505,7 +1505,7 @@ dependencies = [
[[package]]
name = "gpgui-helper"
version = "2.2.0"
version = "2.2.1"
dependencies = [
"anyhow",
"clap",
@ -1523,7 +1523,7 @@ dependencies = [
[[package]]
name = "gpservice"
version = "2.2.0"
version = "2.2.1"
dependencies = [
"anyhow",
"axum",
@ -2537,7 +2537,7 @@ dependencies = [
[[package]]
name = "openconnect"
version = "2.2.0"
version = "2.2.1"
dependencies = [
"cc",
"common",

View File

@ -5,7 +5,7 @@ members = ["crates/*", "apps/gpclient", "apps/gpservice", "apps/gpauth", "apps/g
[workspace.package]
rust-version = "1.70"
version = "2.2.0"
version = "2.2.1"
authors = ["Kevin Yue <k3vinyue@gmail.com>"]
homepage = "https://github.com/yuezk/GlobalProtect-openconnect"
edition = "2021"

View File

@ -1,5 +1,9 @@
# Changelog
## 2.2.1 - 2024-05-07
- GUI: Restore the default browser auth implementation (fix [#360](https://github.com/yuezk/GlobalProtect-openconnect/issues/360))
## 2.2.0 - 2024-04-30
- CLI: support authentication with external browser (fix [#298](https://github.com/yuezk/GlobalProtect-openconnect/issues/298))

View File

@ -181,22 +181,24 @@ fn parse_res_xml(res_xml: &str, is_gateway: bool) -> anyhow::Result<Prelogin> {
return Ok(Prelogin::Saml(saml_prelogin));
}
let label_username = xml::get_child_text(&doc, "username-label");
let label_password = xml::get_child_text(&doc, "password-label");
// Check if the prelogin response is standard login
if label_username.is_some() && label_password.is_some() {
let auth_message =
xml::get_child_text(&doc, "authentication-message").unwrap_or(String::from("Please enter the login credentials"));
let standard_prelogin = StandardPrelogin {
region,
is_gateway,
auth_message,
label_username: label_username.unwrap(),
label_password: label_password.unwrap(),
};
let label_username = xml::get_child_text(&doc, "username-label").unwrap_or_else(|| {
info!("Username label has no value, using default");
String::from("Username")
});
let label_password = xml::get_child_text(&doc, "password-label").unwrap_or_else(|| {
info!("Password label has no value, using default");
String::from("Password")
});
Ok(Prelogin::Standard(standard_prelogin))
} else {
Err(anyhow!("Invalid prelogin response"))
}
let auth_message =
xml::get_child_text(&doc, "authentication-message").unwrap_or(String::from("Please enter the login credentials"));
let standard_prelogin = StandardPrelogin {
region,
is_gateway,
auth_message,
label_username,
label_password,
};
Ok(Prelogin::Standard(standard_prelogin))
}