소스 검색

fix disable two factor bug

ashilkn 2 년 전
부모
커밋
8be02877bf
1개의 변경된 파일4개의 추가작업 그리고 5개의 파일을 삭제
  1. 4 5
      lib/ui/settings/security_section_widget.dart

+ 4 - 5
lib/ui/settings/security_section_widget.dart

@@ -77,11 +77,10 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
                   context,
                   "Please authenticate to configure two-factor authentication",
                 );
-                final isTwoFactorEnabled =
-                    await UserService.instance.fetchTwoFactorStatus();
+                final isTwoFactorEnabled = _config.hasEnabledTwoFactor();
                 if (hasAuthenticated) {
                   if (isTwoFactorEnabled) {
-                    _disableTwoFactor(completer);
+                    await _disableTwoFactor(completer);
                   } else {
                     await UserService.instance
                         .setupTwoFactor(context, completer);
@@ -165,7 +164,7 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
     );
   }
 
-  void _disableTwoFactor(Completer completer) {
+  Future<void> _disableTwoFactor(Completer completer) async {
     final AlertDialog alert = AlertDialog(
       title: const Text("Disable two-factor"),
       content: const Text(
@@ -200,7 +199,7 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
       ],
     );
 
-    showDialog(
+    await showDialog(
       context: context,
       builder: (BuildContext context) {
         return alert;