1. switch sides not check 2fa
2. let self.authorized=true ahead of return, call try_start_cm when 2fa confirmed for updating authorized state
3. flutter 2fa dialog button color

port forward check and sciter will be later on

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2024-01-21 21:53:29 +08:00 committed by GitHub
parent 5770aeee26
commit 48102e9c53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 8 deletions

View File

@ -1851,11 +1851,11 @@ void enter2FaDialog(
title: Text(translate('enter-2fa-title')),
content: codeField,
actions: [
dialogButton(
'Cancel',
onPressed: cancel,
isOutline: true,
),
dialogButton('Cancel',
onPressed: cancel,
isOutline: true,
style: TextStyle(
color: Theme.of(context).textTheme.bodyMedium?.color)),
Obx(() => dialogButton(
'OK',
onPressed: submitReady.isTrue ? submit : null,

View File

@ -1033,10 +1033,11 @@ impl Connection {
if self.authorized {
return;
}
if self.require_2fa.is_some() && !self.is_recent_session(true) {
if self.require_2fa.is_some() && !self.is_recent_session(true) && !self.from_switch {
self.send_login_error(crate::client::REQUIRE_2FA).await;
return;
}
self.authorized = true;
let (conn_type, auth_conn_type) = if self.file_transfer.is_some() {
(1, AuthConnType::FileTransfer)
} else if self.port_forward_socket.is_some() {
@ -1170,7 +1171,6 @@ impl Connection {
username = "".to_owned();
}
}
self.authorized = true;
#[cfg(all(feature = "flutter", feature = "plugin_framework"))]
#[cfg(not(any(target_os = "android", target_os = "ios")))]
PLUGIN_BLOCK_INPUT_TXS
@ -1686,6 +1686,11 @@ impl Connection {
self.update_failure(failure, true, 1);
self.require_2fa.take();
self.send_logon_response().await;
self.try_start_cm(
self.lr.my_id.to_owned(),
self.lr.my_name.to_owned(),
self.authorized,
);
let session = SESSIONS
.lock()
.unwrap()
@ -1747,7 +1752,11 @@ impl Connection {
if uuid == uuid_old {
self.from_switch = true;
self.send_logon_response().await;
self.try_start_cm(lr.my_id.clone(), lr.my_name.clone(), self.authorized);
self.try_start_cm(
lr.my_id.clone(),
lr.my_name.clone(),
self.authorized,
);
#[cfg(not(any(target_os = "android", target_os = "ios")))]
self.try_start_cm_ipc();
}