mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
recent/ab password keep same: sync connected password to addressbook anyway, delete recent password
also delete ab password Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
@@ -752,14 +752,13 @@ abstract class BasePeerCard extends StatelessWidget {
|
||||
style: style,
|
||||
),
|
||||
proc: () async {
|
||||
if (tab == PeerTabIndex.ab) {
|
||||
gFFI.abModel.unrememberPassword(id);
|
||||
await bind.mainForgetPassword(id: id);
|
||||
gFFI.abModel.pushAb();
|
||||
} else {
|
||||
bind.mainForgetPassword(id: id);
|
||||
showToast(translate('Successful'));
|
||||
bool result = gFFI.abModel.changePassword(id, '');
|
||||
await bind.mainForgetPassword(id: id);
|
||||
if (result) {
|
||||
bool toast = tab == PeerTabIndex.ab;
|
||||
gFFI.abModel.pushAb(toastIfFail: toast, toastIfSucc: toast);
|
||||
}
|
||||
showToast(translate('Successful'));
|
||||
},
|
||||
padding: menuPadding,
|
||||
dismissOnClicked: true,
|
||||
|
||||
@@ -211,12 +211,15 @@ class AbModel {
|
||||
it.first.alias = alias;
|
||||
}
|
||||
|
||||
void unrememberPassword(String id) {
|
||||
bool changePassword(String id, String hash) {
|
||||
final it = peers.where((element) => element.id == id);
|
||||
if (it.isEmpty) {
|
||||
return;
|
||||
if (it.isNotEmpty) {
|
||||
if (it.first.hash != hash) {
|
||||
it.first.hash = hash;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
it.first.hash = '';
|
||||
return false;
|
||||
}
|
||||
|
||||
Future<bool> pushAb(
|
||||
@@ -225,6 +228,7 @@ class AbModel {
|
||||
bool isRetry = false}) async {
|
||||
debugPrint(
|
||||
"pushAb: toastIfFail:$toastIfFail, toastIfSucc:$toastIfSucc, isRetry:$isRetry");
|
||||
if (!gFFI.userModel.isLogin) return false;
|
||||
pushError.value = '';
|
||||
if (isRetry) retrying.value = true;
|
||||
DateTime startTime = DateTime.now();
|
||||
|
||||
@@ -241,6 +241,17 @@ class FfiModel with ChangeNotifier {
|
||||
handleReloading(evt);
|
||||
} else if (name == 'plugin_option') {
|
||||
handleOption(evt);
|
||||
} else if (name == "sync_peer_password_to_ab") {
|
||||
if (desktopType == DesktopType.main) {
|
||||
final id = evt['id'];
|
||||
final password = evt['password'];
|
||||
if (id != null && password != null) {
|
||||
if (gFFI.abModel
|
||||
.changePassword(id.toString(), password.toString())) {
|
||||
gFFI.abModel.pushAb(toastIfFail: false, toastIfSucc: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
debugPrint('Unknown event name: $name');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user