]> git.proxmox.com Git - flutter/proxmox_login_manager.git/commitdiff
tfa: allow closing tfa form
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 4 Jul 2023 13:53:18 +0000 (15:53 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 4 Jul 2023 15:08:11 +0000 (17:08 +0200)
abort the login when the form returns null. This happens if the user
presses 'X' in the tfa form.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
lib/proxmox_login_form.dart

index dbc912a12dafb15362e0db7befbe227f0365dd7e..861947d11876c84e3cda4e9e0c741202c53f6f12 100644 (file)
@@ -433,11 +433,21 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
 
       if (client.credentials.tfa != null &&
           client.credentials.tfa!.kinds().length > 0) {
-        client = await Navigator.of(context).push(MaterialPageRoute(
+        ProxmoxApiClient? tfaclient =
+            await Navigator.of(context).push(MaterialPageRoute(
           builder: (context) => ProxmoxTfaForm(
             apiClient: client,
           ),
         ));
+
+        if (tfaclient != null) {
+          client = tfaclient;
+        } else {
+          setState(() {
+            _progressModel.inProgress -= 1;
+          });
+          return;
+        }
       }
 
       final status = await client.getClusterStatus();