mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-11-04 00:33:12 +00:00
fix: skip password persistence for consent connections
This commit is contained in:
1 parent
a2d21df237
commit
417dcdf7bb
2 files changed
+21
-3
No files matched your search
+4
-3
@@ -3679,7 +3679,7 @@ impl LoginConfigHandler {
|
||||
let password0 = config.password.clone();
|
||||
let remember = self.remember;
|
||||
let hash = self.hash.clone();
|
||||
if remember {
|
||||
if remember && !self.skips_saved_password() {
|
||||
// remember is true: use PeerConfig password or ui login
|
||||
// not sync shared password to recent
|
||||
if !password.is_empty()
|
||||
@@ -3689,7 +3689,7 @@ impl LoginConfigHandler {
|
||||
config.password = password.clone();
|
||||
log::debug!("remember password of {}", self.id);
|
||||
}
|
||||
} else {
|
||||
} else if !self.skips_saved_password() {
|
||||
if self.password_source.is_personal_ab(&password) {
|
||||
// sync personal ab password to recent automatically
|
||||
config.password = password.clone();
|
||||
@@ -3716,7 +3716,8 @@ impl LoginConfigHandler {
|
||||
#[cfg(feature = "flutter")]
|
||||
{
|
||||
// sync connected password to personal ab automatically if it is not shared password
|
||||
if !config.password.is_empty()
|
||||
if !self.skips_saved_password()
|
||||
&& !config.password.is_empty()
|
||||
&& !self.password_source.is_shared_ab(&password, &hash)
|
||||
&& !self.password_source.is_personal_ab(&password)
|
||||
{
|
||||
|
||||
@@ -202,6 +202,23 @@ mod tests {
|
||||
assert_eq!(login.os_login.password, "os password");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn consent_does_not_save_personal_ab_password() {
|
||||
for consent in [false, true] {
|
||||
let mut lc = client::LoginConfigHandler::default();
|
||||
lc.id = format!("consent-ab-password-test-{}", uuid::Uuid::new_v4());
|
||||
lc.password = vec![3; 32];
|
||||
lc.password_source = client::PasswordSource::PersonalAb(lc.password.clone());
|
||||
if consent {
|
||||
assert!(lc.set_login_method("consent"));
|
||||
}
|
||||
lc.handle_peer_info(&PeerInfo::default());
|
||||
let saved = PeerConfig::load(&lc.id).password;
|
||||
PeerConfig::remove(&lc.id);
|
||||
assert_eq!(saved, if consent { Vec::new() } else { lc.password });
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn consent_preserves_saved_password() {
|
||||
let (mut stream, mut peer) = connection().await;
|
||||
|
||||
Reference in new issue
Block a user