improv: network authentication
This commit is contained in:
parent
2924fea3ac
commit
f48bcde63b
3 changed files with 31 additions and 55 deletions
|
|
@ -20,7 +20,6 @@ use cosmic_settings_network_manager_subscription::{
|
|||
self as network_manager, NetworkManagerState,
|
||||
available_wifi::{AccessPoint, NetworkType},
|
||||
current_networks::ActiveConnectionInfo,
|
||||
hw_address::HwAddress,
|
||||
nm_secret_agent,
|
||||
};
|
||||
use cosmic_settings_page::{self as page, Section, section};
|
||||
|
|
@ -103,7 +102,6 @@ enum WiFiDialog {
|
|||
Forget(network_manager::SSID),
|
||||
Password {
|
||||
ssid: network_manager::SSID,
|
||||
hw_address: HwAddress,
|
||||
identity: Option<String>,
|
||||
password: SecureString,
|
||||
password_hidden: bool,
|
||||
|
|
@ -353,12 +351,7 @@ impl Page {
|
|||
}
|
||||
|
||||
match req {
|
||||
network_manager::Request::Authenticate {
|
||||
ssid,
|
||||
identity,
|
||||
hw_address,
|
||||
..
|
||||
} => {
|
||||
network_manager::Request::Authenticate { ssid, identity, .. } => {
|
||||
if success {
|
||||
self.connecting.remove(ssid.as_str());
|
||||
} else {
|
||||
|
|
@ -366,7 +359,6 @@ impl Page {
|
|||
self.dialog = Some(WiFiDialog::Password {
|
||||
ssid: ssid.into(),
|
||||
identity,
|
||||
hw_address,
|
||||
password: SecureString::from(""),
|
||||
password_hidden: true,
|
||||
tx: Arc::new(Mutex::new(None)),
|
||||
|
|
@ -377,9 +369,9 @@ impl Page {
|
|||
|
||||
network_manager::Request::SelectAccessPoint(
|
||||
ssid,
|
||||
hw_address,
|
||||
network_type,
|
||||
_tx,
|
||||
interface,
|
||||
) => {
|
||||
if success || matches!(network_type, NetworkType::Open) {
|
||||
self.connecting.remove(ssid.as_ref());
|
||||
|
|
@ -388,7 +380,6 @@ impl Page {
|
|||
ssid,
|
||||
identity: matches!(network_type, NetworkType::EAP)
|
||||
.then(String::new),
|
||||
hw_address,
|
||||
password: SecureString::from(""),
|
||||
password_hidden: true,
|
||||
tx: Arc::new(Mutex::new(None)),
|
||||
|
|
@ -499,9 +490,9 @@ impl Page {
|
|||
.sender
|
||||
.unbounded_send(network_manager::Request::SelectAccessPoint(
|
||||
ssid,
|
||||
ap.hw_address,
|
||||
ap.network_type,
|
||||
self.secret_tx.clone(),
|
||||
self.active_device.as_ref().map(|d| d.interface.clone()),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -528,7 +519,6 @@ impl Page {
|
|||
self.dialog = Some(WiFiDialog::Password {
|
||||
ssid,
|
||||
identity: matches!(ap.network_type, NetworkType::EAP).then(String::new),
|
||||
hw_address: ap.hw_address,
|
||||
password: SecureString::from(""),
|
||||
password_hidden: true,
|
||||
tx: Arc::new(Mutex::new(None)),
|
||||
|
|
@ -553,7 +543,6 @@ impl Page {
|
|||
ssid,
|
||||
identity,
|
||||
password,
|
||||
hw_address,
|
||||
tx,
|
||||
..
|
||||
} = dialog
|
||||
|
|
@ -562,6 +551,7 @@ impl Page {
|
|||
self.connecting.insert(ssid.clone());
|
||||
let nm_sender = nm.sender.clone();
|
||||
let secret_tx = self.secret_tx.clone();
|
||||
let interface = self.active_device.as_ref().map(|d| d.interface.clone());
|
||||
return Task::future(async move {
|
||||
let mut guard = tx.lock().await;
|
||||
if let Some(tx) = guard.take() {
|
||||
|
|
@ -570,9 +560,9 @@ impl Page {
|
|||
_ = nm_sender.unbounded_send(network_manager::Request::Authenticate {
|
||||
ssid: ssid.to_string(),
|
||||
identity,
|
||||
hw_address,
|
||||
password,
|
||||
secret_tx,
|
||||
interface,
|
||||
});
|
||||
}
|
||||
})
|
||||
|
|
@ -718,7 +708,6 @@ impl Page {
|
|||
ssid,
|
||||
password: previous,
|
||||
password_hidden: true,
|
||||
hw_address: ap.hw_address,
|
||||
identity: matches!(ap.network_type, NetworkType::EAP).then(String::new),
|
||||
tx,
|
||||
});
|
||||
|
|
@ -736,7 +725,6 @@ impl Page {
|
|||
ssid,
|
||||
password,
|
||||
identity,
|
||||
hw_address,
|
||||
..
|
||||
}) = self.dialog.take()
|
||||
{
|
||||
|
|
@ -746,7 +734,6 @@ impl Page {
|
|||
tx: Arc::new(Mutex::new(None)),
|
||||
ssid,
|
||||
identity,
|
||||
hw_address,
|
||||
});
|
||||
return task::message(Message::FocusSecureInput);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue