|
|
@ -269,6 +269,19 @@ fn _json_err_twofactor(providers: &[i32], user_uuid: &str, conn: &DbConn) -> Api
|
|
|
|
result["TwoFactorProviders2"][provider.to_string()] = Value::Object(map);
|
|
|
|
result["TwoFactorProviders2"][provider.to_string()] = Value::Object(map);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Some(TwoFactorType::YubiKey) => {
|
|
|
|
|
|
|
|
let twofactor = match TwoFactor::find_by_user_and_type(user_uuid, TwoFactorType::YubiKey as i32, &conn) {
|
|
|
|
|
|
|
|
Some(tf) => tf,
|
|
|
|
|
|
|
|
None => err!("No YubiKey devices registered"),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let yubikey_metadata: two_factor::YubikeyMetadata = serde_json::from_str(&twofactor.data).expect("Can't parse Yubikey Metadata");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mut map = JsonMap::new();
|
|
|
|
|
|
|
|
map.insert("Nfc".into(), Value::Bool(yubikey_metadata.Nfc));
|
|
|
|
|
|
|
|
result["TwoFactorProviders2"][provider.to_string()] = Value::Object(map);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_ => {}
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|