]> git.proxmox.com Git - flutter/proxmox_login_manager.git/commitdiff
tfa: only open tfa form when there is at least one type available
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 4 Jul 2023 13:27:37 +0000 (15:27 +0200)
committerDominik Csapak <d.csapak@proxmox.com>
Tue, 4 Jul 2023 13:28:37 +0000 (15:28 +0200)
Otherwise the tfa form will error out trying to access an index in the
array that does not exist (it assumes there is at least one type).
This can happen e.g. if there is only webauthn for a user configured

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

index d92417316da6442d713d3afde1d2333049abfcd8..dbc912a12dafb15362e0db7befbe227f0365dd7e 100644 (file)
@@ -431,7 +431,8 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
       var client = await proxclient.authenticate(
           '$username@$realm', password, origin, settings.sslValidation!);
 
-      if (client.credentials.tfa != null) {
+      if (client.credentials.tfa != null &&
+          client.credentials.tfa!.kinds().length > 0) {
         client = await Navigator.of(context).push(MaterialPageRoute(
           builder: (context) => ProxmoxTfaForm(
             apiClient: client,