Skip to content

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

verify_login, but not eable yet

rustdesk8f545491a284
diff --git a/src/common.rs b/src/common.rs
index bcd7d3647..56361a5da 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -1711,3 +1711,27 @@ pub fn get_builtin_option(key: &str) -> String {
.cloned()
.unwrap_or_default()
}
+
+pub fn verify_login(raw: &str, id: &str) -> bool {
+ true
+ /*
+ #[cfg(debug_assertions)]
+ return true;
+ let Ok(pk) = crate::decode64("IycjQd4TmWvjjLnYd796Rd+XkK+KG+7GU1Ia7u4+vSw=") else {
+ return false;
+ };
+ let Some(key) = get_pk(&pk).map(|x| sign::PublicKey(x)) else {
+ return false;
+ };
+ let Ok(v) = crate::decode64(raw) else {
+ return false;
+ };
+ let raw = sign::verify(&v, &key).unwrap_or_default();
+ let v_str = std::str::from_utf8(&raw)
+ .unwrap_or_default()
+ .split(":")
+ .next()
+ .unwrap_or_default();
+ v_str == id
+ */
+}
diff --git a/src/ui.rs b/src/ui.rs
index 27586a54f..6bef48ba2 100644
--- a/src/ui.rs
+++ b/src/ui.rs
@@ -633,6 +633,10 @@ impl UI {
pub fn verify2fa(&self, code: String) -> bool {
verify2fa(code)
}
+
+ fn verify_login(&self, raw: String, id: String) -> bool {
+ crate::verify_login(&raw, &id)
+ }
fn generate_2fa_img_src(&self, data: String) -> String {
let v = qrcode_generator::to_png_to_vec(data, qrcode_generator::QrCodeEcc::Low, 128)
@@ -739,6 +743,7 @@ impl sciter::EventHandler for UI {
fn generate_2fa_img_src(String);
fn verify2fa(String);
fn check_hwcodec();
+ fn verify_login(String, String);
}
}
diff --git a/src/ui/index.tis b/src/ui/index.tis
index 3e5aa8ad0..1dff3cecb 100644
--- a/src/ui/index.tis
+++ b/src/ui/index.tis
@@ -1358,7 +1358,8 @@ function logout() {
}
function refreshCurrentUser() {
- if (!handler.get_local_option("access_token")) return;
+ var token = handler.get_local_option("access_token");
+ if (!token) { return; }
abLoading = true;
abError = "";
app.update();
@@ -1370,6 +1371,10 @@ function refreshCurrentUser() {
handleAbError(data.error);
return;
}
+ if (!handler.verify_login(data.verifier, token)) {
+ handleAbError("Please update your self-hosting server Pro to latest version");
+ return;
+ }
set_local_user_info(data);
myIdMenu.update();
getAb();