fix(splash): show mdm workspace tenant name instead of mdm url

The WorkspaceTenantName is populated far more consistently than MdmUrl.

This commit switches to extracting that instead and passing it on to the
MDM splash screen so that users on non-corporate devices who may have
unintentionally enrolled themselves into BYOD MDM by logging into an
account a clicking "Yes" on some dark pattern pop-up have a clear
indication of why they are seeing the splash, and can take the
appropriate steps to remove the MDM profile from their system if
desired.
This commit is contained in:
LGUG2Z
2026-01-04 07:30:35 -08:00
parent a7380db47c
commit b792328676

View File

@@ -18,20 +18,23 @@ pub fn mdm_enrollment() -> eyre::Result<(bool, Option<String>)> {
command.args(["/status"]);
let stdout = command.output()?.stdout;
let output = std::str::from_utf8(&stdout)?;
if !output.contains("MdmUrl") {
if !output.contains("WorkspaceTenantName") {
return Ok((false, None));
}
let mut server = None;
let mut tenant = None;
for line in output.lines() {
if line.contains("MdmUrl") {
if line.contains("WorkspaceTenantName") {
let line = line.trim().to_string();
server = Some(line.trim_start_matches("MdmUrl : ").to_string())
tenant = Some(
line.trim_start_matches("WorkspaceTenantName : ")
.to_string(),
)
}
}
Ok((true, server))
Ok((true, tenant))
}
fn is_valid_payload(raw: &str, fresh: bool) -> eyre::Result<bool> {