[pve-devel] [PATCH manager] ui: Fix #2827: Add verify SSL cert checkbox for ldap

Dominic Jäger d.jaeger at proxmox.com
Thu Oct 15 12:00:18 CEST 2020


Because the option is too important to be hidden in CLI.

Signed-off-by: Dominic Jäger <d.jaeger at proxmox.com>
---
I haven't managed to test this against an LDAP server yet, but the GUI elements
go on and off as I had it in mind and the options in /etc/pve/domains.cfg
change as expected.

 www/manager6/dc/AuthEditLDAP.js | 35 +++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/www/manager6/dc/AuthEditLDAP.js b/www/manager6/dc/AuthEditLDAP.js
index c5976769..ccaabc4e 100644
--- a/www/manager6/dc/AuthEditLDAP.js
+++ b/www/manager6/dc/AuthEditLDAP.js
@@ -53,11 +53,46 @@ Ext.define('PVE.panel.LDAPInputPanel', {
 		fieldLabel: 'SSL',
 		name: 'secure',
 		uncheckedValue: 0,
+		listeners: {
+		    change: function(me, newValue) {
+			let verifyCheckbox = me.nextSibling('proxmoxcheckbox[name=verify]');
+			if (newValue === true) {
+			    verifyCheckbox.enable();
+			} else {
+			    verifyCheckbox.disable();
+			    verifyCheckbox.setValue(0);
+			}
+		    },
+		},
+	    },
+	    {
+		xtype: 'proxmoxcheckbox',
+		fieldLabel: gettext('Verify Certificate'),
+		name: 'verify',
+		unceckedValue: 0,
+		disabled: true,
+		checked: false,
+		autoEl: {
+		    tag: 'div',
+		    'data-qtip': gettext('Verify SSL certificate of the server'),
+		},
 	    },
 	];
 
 	me.callParent();
     },
+    onGetValues: function(values) {
+	let me = this;
+
+	if (!values.verify) {
+	    if (!me.isCreate) {
+		Proxmox.Utils.assemble_field_data(values, { 'delete': 'verify' });
+	    }
+	    delete values.verify;
+	}
+
+	return me.callParent([values]);
+    },
 });
 
 Ext.define('PVE.panel.LDAPSyncInputPanel', {
-- 
2.20.1





More information about the pve-devel mailing list