[pve-devel] [PATCH proxmox-login-manager 2/2] tfa: allow closing tfa form

Dominik Csapak d.csapak at proxmox.com
Tue Jul 4 15:53:18 CEST 2023


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 at proxmox.com>
---
 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






More information about the pve-devel mailing list