abort the login when the form returns null. This happens if the user
presses 'X' in the tfa form.

Signed-off-by: Dominik Csapak <[email protected]>
---
 lib/proxmox_login_form.dart | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/proxmox_login_form.dart b/lib/proxmox_login_form.dart
index dbc912a..861947d 100644
--- a/lib/proxmox_login_form.dart
+++ b/lib/proxmox_login_form.dart
@@ -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();
-- 
2.30.2



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to