fix forget password toast error when personal ab doesn't contain this id (#7589)

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2024-04-02 23:18:52 +08:00 committed by GitHub
parent edefa5f786
commit 41d99d5108
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -750,8 +750,10 @@ abstract class BasePeerCard extends StatelessWidget {
if (succ) {
showToast(translate('Successful'));
} else {
BotToast.showText(
contentColor: Colors.red, text: translate("Failed"));
if (tab.index == PeerTabIndex.ab.index) {
BotToast.showText(
contentColor: Colors.red, text: translate("Failed"));
}
}
},
padding: menuPadding,

View File

@ -1490,7 +1490,7 @@ class Ab extends BaseAb {
@override
Future<bool> changePersonalHashPassword(String id, String hash) async {
if (!personal) return false;
if (!peers.any((e) => e.id == id)) return false;
if (!peers.any((e) => e.id == id)) return true;
return await _setPassword({"id": id, "hash": hash});
}