mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
remove special treatment when only use permanent passwrod but no password set (#8566)
1. Remove special treatment when only use permanent passwrod but no password set, it has no need and `Connection not allowd` prompt make user confusing. 2. When only use permanent password is chosen and the permanent password is empty, pop up the set-password dialog, if still not set in the dialog, back to the old choice 3. Add cancel confirm for 2fa and telegram bot Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -838,7 +838,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
||||
}
|
||||
}
|
||||
|
||||
void setPasswordDialog() async {
|
||||
void setPasswordDialog({VoidCallback? notEmptyCallback}) async {
|
||||
final pw = await bind.mainGetPermanentPassword();
|
||||
final p0 = TextEditingController(text: pw);
|
||||
final p1 = TextEditingController(text: pw);
|
||||
@@ -878,6 +878,9 @@ void setPasswordDialog() async {
|
||||
return;
|
||||
}
|
||||
bind.mainSetPermanentPassword(password: pass);
|
||||
if (pass.isNotEmpty) {
|
||||
notEmptyCallback?.call();
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
@@ -684,10 +684,18 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
|
||||
RxBool hasBot = bind.mainHasValidBotSync().obs;
|
||||
update() async {
|
||||
has2fa.value = bind.mainHasValid2FaSync();
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
onChanged(bool? checked) async {
|
||||
change2fa(callback: update);
|
||||
if (checked == false) {
|
||||
CommonConfirmDialog(
|
||||
gFFI.dialogManager, translate('cancel-2fa-confirm-tip'), () {
|
||||
change2fa(callback: update);
|
||||
});
|
||||
} else {
|
||||
change2fa(callback: update);
|
||||
}
|
||||
}
|
||||
|
||||
final tfa = GestureDetector(
|
||||
@@ -716,10 +724,18 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
|
||||
}
|
||||
updateBot() async {
|
||||
hasBot.value = bind.mainHasValidBotSync();
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
onChangedBot(bool? checked) async {
|
||||
changeBot(callback: updateBot);
|
||||
if (checked == false) {
|
||||
CommonConfirmDialog(
|
||||
gFFI.dialogManager, translate('cancel-bot-confirm-tip'), () {
|
||||
changeBot(callback: updateBot);
|
||||
});
|
||||
} else {
|
||||
changeBot(callback: updateBot);
|
||||
}
|
||||
}
|
||||
|
||||
final bot = GestureDetector(
|
||||
@@ -873,12 +889,22 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
|
||||
label: value,
|
||||
onChanged: locked
|
||||
? null
|
||||
: ((value) {
|
||||
() async {
|
||||
: ((value) async {
|
||||
callback() async {
|
||||
await model.setVerificationMethod(
|
||||
passwordKeys[passwordValues.indexOf(value)]);
|
||||
await model.updatePasswordModel();
|
||||
}();
|
||||
}
|
||||
|
||||
if (value ==
|
||||
passwordValues[passwordKeys
|
||||
.indexOf(kUsePermanentPassword)] &&
|
||||
(await bind.mainGetPermanentPassword())
|
||||
.isEmpty) {
|
||||
setPasswordDialog(notEmptyCallback: callback);
|
||||
} else {
|
||||
await callback();
|
||||
}
|
||||
}),
|
||||
))
|
||||
.toList();
|
||||
|
||||
Reference in New Issue
Block a user