fix port forward 2fa (#6956)

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2024-01-22 19:57:23 +08:00 committed by GitHub
parent ed24f432c3
commit 2e16a2be56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 8 deletions

View File

@ -141,9 +141,10 @@ async fn connect_and_login(
}
Some(message::Union::LoginResponse(lr)) => match lr.union {
Some(login_response::Union::Error(err)) => {
interface.handle_login_error(&err);
if !interface.handle_login_error(&err) {
return Ok(None);
}
}
Some(login_response::Union::PeerInfo(pi)) => {
interface.handle_peer_info(pi);
break;
@ -168,6 +169,9 @@ async fn connect_and_login(
Some(Data::Login((os_username, os_password, password, remember))) => {
interface.handle_login_from_ui(os_username, os_password, password, remember, &mut stream).await;
}
Some(Data::Message(msg)) => {
allow_err!(stream.send(&msg).await);
}
_ => {}
}
},

View File

@ -578,6 +578,9 @@ impl Connection {
if !conn.on_message(msg_in).await {
break;
}
if conn.port_forward_socket.is_some() && conn.authorized {
break;
}
}
}
}
@ -1627,9 +1630,6 @@ impl Connection {
self.linux_headless_handle.wait_desktop_cm_ready().await;
self.send_logon_response().await;
self.try_start_cm(lr.my_id.clone(), lr.my_name.clone(), self.authorized);
if self.port_forward_socket.is_some() {
return false;
}
} else {
self.send_login_error(err_msg).await;
}
@ -1667,9 +1667,6 @@ impl Connection {
self.linux_headless_handle.wait_desktop_cm_ready().await;
self.send_logon_response().await;
self.try_start_cm(lr.my_id, lr.my_name, self.authorized);
if self.port_forward_socket.is_some() {
return false;
}
} else {
self.send_login_error(err_msg).await;
}