opt 2fa (#6942)
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:
parent
5770aeee26
commit
48102e9c53
@ -1851,11 +1851,11 @@ void enter2FaDialog(
|
|||||||
title: Text(translate('enter-2fa-title')),
|
title: Text(translate('enter-2fa-title')),
|
||||||
content: codeField,
|
content: codeField,
|
||||||
actions: [
|
actions: [
|
||||||
dialogButton(
|
dialogButton('Cancel',
|
||||||
'Cancel',
|
onPressed: cancel,
|
||||||
onPressed: cancel,
|
isOutline: true,
|
||||||
isOutline: true,
|
style: TextStyle(
|
||||||
),
|
color: Theme.of(context).textTheme.bodyMedium?.color)),
|
||||||
Obx(() => dialogButton(
|
Obx(() => dialogButton(
|
||||||
'OK',
|
'OK',
|
||||||
onPressed: submitReady.isTrue ? submit : null,
|
onPressed: submitReady.isTrue ? submit : null,
|
||||||
|
@ -1033,10 +1033,11 @@ impl Connection {
|
|||||||
if self.authorized {
|
if self.authorized {
|
||||||
return;
|
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;
|
self.send_login_error(crate::client::REQUIRE_2FA).await;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
self.authorized = true;
|
||||||
let (conn_type, auth_conn_type) = if self.file_transfer.is_some() {
|
let (conn_type, auth_conn_type) = if self.file_transfer.is_some() {
|
||||||
(1, AuthConnType::FileTransfer)
|
(1, AuthConnType::FileTransfer)
|
||||||
} else if self.port_forward_socket.is_some() {
|
} else if self.port_forward_socket.is_some() {
|
||||||
@ -1170,7 +1171,6 @@ impl Connection {
|
|||||||
username = "".to_owned();
|
username = "".to_owned();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.authorized = true;
|
|
||||||
#[cfg(all(feature = "flutter", feature = "plugin_framework"))]
|
#[cfg(all(feature = "flutter", feature = "plugin_framework"))]
|
||||||
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
PLUGIN_BLOCK_INPUT_TXS
|
PLUGIN_BLOCK_INPUT_TXS
|
||||||
@ -1686,6 +1686,11 @@ impl Connection {
|
|||||||
self.update_failure(failure, true, 1);
|
self.update_failure(failure, true, 1);
|
||||||
self.require_2fa.take();
|
self.require_2fa.take();
|
||||||
self.send_logon_response().await;
|
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
|
let session = SESSIONS
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
@ -1747,7 +1752,11 @@ impl Connection {
|
|||||||
if uuid == uuid_old {
|
if uuid == uuid_old {
|
||||||
self.from_switch = true;
|
self.from_switch = true;
|
||||||
self.send_logon_response().await;
|
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")))]
|
#[cfg(not(any(target_os = "android", target_os = "ios")))]
|
||||||
self.try_start_cm_ipc();
|
self.try_start_cm_ipc();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user