If a dependency of a formula returns undefined, it will not get updated,
even if the other parts of the formula would work.

So we change the default to 'null' which gets handled differently,
but serves the same purpose for us.

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
 www/manager6/dc/TFAEdit.js | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/www/manager6/dc/TFAEdit.js b/www/manager6/dc/TFAEdit.js
index c57c5339..d4a6c22d 100644
--- a/www/manager6/dc/TFAEdit.js
+++ b/www/manager6/dc/TFAEdit.js
@@ -100,21 +100,21 @@ Ext.define('PVE.window.TFAEdit', {
        data: {
            in_totp_tab: true,
            tfa_required: false,
-           tfa_type: undefined,
+           tfa_type: null, // dependecies of formulas should not be undefined
            valid: false,
            u2f_available: true
        },
        formulas: {
            canDeleteTFA: function(get) {
-               return (get('tfa_type') !== undefined && !get('tfa_required'));
+               return (get('tfa_type') !== null && !get('tfa_required'));
            },
            canSetupTOTP: function(get) {
                var tfa = get('tfa_type');
-               return (tfa === undefined || tfa === 'totp' || tfa === 1);
+               return (tfa === null || tfa === 'totp' || tfa === 1);
            },
            canSetupU2F: function(get) {
                var tfa = get('tfa_type');
-               return (get('u2f_available') && (tfa === undefined || tfa === 
'u2f' || tfa === 1));
+               return (get('u2f_available') && (tfa === null || tfa === 'u2f' 
|| tfa === 1));
            }
        }
     },
@@ -175,7 +175,7 @@ Ext.define('PVE.window.TFAEdit', {
                    });
                    me.down('#qrbox').getEl().appendChild(me.qrdiv);
 
-                   viewmodel.set('tfa_type', me.tfa_type);
+                   viewmodel.set('tfa_type', me.tfa_type || null);
                    if (!me.tfa_type) {
                        this.randomizeSecret();
                    } else {
-- 
2.11.0


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to