[pve-devel] [PATCH manager 2/2] webui: acme: add eab fields

Folke Gleumes f.gleumes at proxmox.com
Tue Jan 16 15:33:38 CET 2024


Adds fields for eab credentials. By default eab is optional, but if the
directory should report that eab is required, the eab credential fields
are marked as mandatory and prevent the form from being submittable
until credentials are provided.

Signed-off-by: Folke Gleumes <f.gleumes at proxmox.com>
---
 www/manager6/node/ACME.js | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/www/manager6/node/ACME.js b/www/manager6/node/ACME.js
index 5b71778a..ab2f0211 100644
--- a/www/manager6/node/ACME.js
+++ b/www/manager6/node/ACME.js
@@ -16,6 +16,12 @@ Ext.define('PVE.node.ACMEAccountCreate', {
     viewModel: {
 	data: {
 	    customDirectory: false,
+	    eabRequired: false,
+	},
+	formulas: {
+	    eabEmptyText: function(get) {
+		return get('eabRequired') ? gettext("required") : gettext("optional");
+	    },
 	},
     },
 
@@ -123,6 +129,7 @@ Ext.define('PVE.node.ACMEAccountCreate', {
 			    let me = this;
 
 			    let w = me.up('window');
+			    let vm = w.getViewModel();
 			    let disp = w.down('#tos_url_display');
 			    let field = w.down('#tos_url');
 			    let checkbox = w.down('#tos_checkbox');
@@ -150,6 +157,7 @@ Ext.define('PVE.node.ACMEAccountCreate', {
 					checkbox.setValue(false);
 					disp.setValue("No terms of service agreement required");
 				    }
+				    vm.set('eabRequired', !!response.result.data.externalAccountRequired);
 				},
 				failure: function(response, opt) {
 				    disp.setValue(undefined);
@@ -184,6 +192,26 @@ Ext.define('PVE.node.ACMEAccountCreate', {
 		return false;
 	    },
 	},
+	{
+	    xtype: 'proxmoxtextfield',
+	    name: 'eab-kid',
+	    fieldLabel: gettext('EAB Key ID'),
+	    bind: {
+		hidden: '{!customDirectory}',
+		allowBlank: '{!eabRequired}',
+		emptyText: '{eabEmptyText}',
+	    },
+	},
+	{
+	    xtype: 'proxmoxtextfield',
+	    name: 'eab-hmac-key',
+	    fieldLabel: gettext('EAB Key'),
+	    bind: {
+		hidden: '{!customDirectory}',
+		allowBlank: '{!eabRequired}',
+		emptyText: '{eabEmptyText}',
+	    },
+	},
     ],
 
     clearToSFields: function() {
-- 
2.39.2





More information about the pve-devel mailing list