mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
2fa for unattended access
This commit is contained in:
@@ -180,6 +180,15 @@ pub fn session_login(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn session_send2fa(
|
||||
session_id: SessionID,
|
||||
code: String,
|
||||
) {
|
||||
if let Some(session) = sessions::get_session_by_session_id(&session_id) {
|
||||
session.send2fa(code);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn session_close(session_id: SessionID) {
|
||||
if let Some(session) = sessions::remove_session_by_session_id(&session_id) {
|
||||
session.close_event_stream(session_id);
|
||||
@@ -2016,6 +2025,23 @@ pub fn main_supported_input_source() -> SyncReturn<String> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main_generate2fa() -> String {
|
||||
crate::auth_2fa::generate2fa()
|
||||
}
|
||||
|
||||
pub fn main_verify2fa(code: String) -> bool {
|
||||
let res = crate::auth_2fa::verify2fa(code);
|
||||
if res {
|
||||
refresh_options();
|
||||
}
|
||||
res
|
||||
}
|
||||
|
||||
pub fn main_has_valid_2fa_sync() -> SyncReturn<bool> {
|
||||
let raw = get_option("2fa");
|
||||
SyncReturn(crate::auth_2fa::get_2fa(Some(raw)).is_some())
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
pub mod server_side {
|
||||
use hbb_common::{config, log};
|
||||
|
||||
Reference in New Issue
Block a user