[pve-devel] [PATCH manager 1/6] ui: dc/AuthEditBase: only add tfa field on auth modes that support that

Dominik Csapak d.csapak at proxmox.com
Thu Jul 1 14:25:01 CEST 2021


for now that are all, but we will ad one where that is not possible

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Utils.js           |  3 +++
 www/manager6/dc/AuthEditBase.js | 14 +++++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 44d72c7b..d728c4be 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -733,17 +733,20 @@ Ext.define('PVE.Utils', {
 	    ipanel: 'pveAuthADPanel',
 	    syncipanel: 'pveAuthLDAPSyncPanel',
 	    add: true,
+	    tfa: true,
 	},
 	ldap: {
 	    name: gettext('LDAP Server'),
 	    ipanel: 'pveAuthLDAPPanel',
 	    syncipanel: 'pveAuthLDAPSyncPanel',
 	    add: true,
+	    tfa: true,
 	},
 	pam: {
 	    name: 'Linux PAM',
 	    ipanel: 'pveAuthBasePanel',
 	    add: false,
+	    tfa: true,
 	},
 	pve: {
 	    name: 'Proxmox VE authentication server',
diff --git a/www/manager6/dc/AuthEditBase.js b/www/manager6/dc/AuthEditBase.js
index f07052a0..e18fbc3b 100644
--- a/www/manager6/dc/AuthEditBase.js
+++ b/www/manager6/dc/AuthEditBase.js
@@ -24,6 +24,8 @@ Ext.define('PVE.panel.AuthBase', {
     initComponent: function() {
 	let me = this;
 
+	let options = PVE.Utils.authSchema[me.type];
+
 	if (!me.column1) { me.column1 = []; }
 	if (!me.column2) { me.column2 = []; }
 	if (!me.columnB) { me.columnB = []; }
@@ -45,11 +47,13 @@ Ext.define('PVE.panel.AuthBase', {
 	    uncheckedValue: 0,
 	});
 
-	// last field of column2is tfa
-	me.column2.push({
-	    xtype: 'pveTFASelector',
-	    deleteEmpty: !me.isCreate,
-	});
+	if (options.tfa) {
+	    // last field of column2is tfa
+	    me.column2.push({
+		xtype: 'pveTFASelector',
+		deleteEmpty: !me.isCreate,
+	    });
+	}
 
 	me.columnB.push({
 	    xtype: 'textfield',
-- 
2.30.2






More information about the pve-devel mailing list