Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

opt 2fa (#6942)

21pages48102e9c5308
diff --git a/flutter/lib/common/widgets/dialog.dart b/flutter/lib/common/widgets/dialog.dart
index b7582c3f1..21dcb9333 100644
--- a/flutter/lib/common/widgets/dialog.dart
+++ b/flutter/lib/common/widgets/dialog.dart
@@ -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,
diff --git a/src/server/connection.rs b/src/server/connection.rs
index 42b963593..8e9e20014 100644
--- a/src/server/connection.rs
+++ b/src/server/connection.rs
@@ -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();
}