]> git.proxmox.com Git - pve-manager.git/commitdiff
ui: acme: add External Account Binding (EAB) related fields
authorFolke Gleumes <f.gleumes@proxmox.com>
Wed, 17 Apr 2024 15:55:05 +0000 (17:55 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 17 Apr 2024 19:16:02 +0000 (21:16 +0200)
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@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
www/manager6/node/ACME.js

index d2863a7c814253dfaecdd7350f0a5899433503e2..a0db51a6b5db8909a03f0a6773a9b5dc8268f685 100644 (file)
@@ -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");
+           },
        },
     },
 
@@ -124,6 +130,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');
@@ -151,6 +158,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);
@@ -185,6 +193,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() {