trust this device to skip 2fa (#9012)
* trust this device to skip 2fa Signed-off-by: 21pages <sunboeasy@gmail.com> * Update connection.rs --------- Signed-off-by: 21pages <sunboeasy@gmail.com> Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
57834840b8
commit
1729ee337f
@@ -1156,15 +1156,29 @@ impl<T: InvokeUiSession> Session<T> {
|
||||
self.send(Data::Login((os_username, os_password, password, remember)));
|
||||
}
|
||||
|
||||
pub fn send2fa(&self, code: String) {
|
||||
pub fn send2fa(&self, code: String, trust_this_device: bool) {
|
||||
let mut msg_out = Message::new();
|
||||
let hwid = if trust_this_device {
|
||||
crate::get_hwid()
|
||||
} else {
|
||||
Bytes::new()
|
||||
};
|
||||
self.lc.write().unwrap().set_option(
|
||||
"trust-this-device".to_string(),
|
||||
if trust_this_device { "Y" } else { "" }.to_string(),
|
||||
);
|
||||
msg_out.set_auth_2fa(Auth2FA {
|
||||
code,
|
||||
hwid,
|
||||
..Default::default()
|
||||
});
|
||||
self.send(Data::Message(msg_out));
|
||||
}
|
||||
|
||||
pub fn get_enable_trusted_devices(&self) -> bool {
|
||||
self.lc.read().unwrap().enable_trusted_devices
|
||||
}
|
||||
|
||||
pub fn new_rdp(&self) {
|
||||
self.send(Data::NewRDP);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user