]> git.proxmox.com Git - pve-manager.git/commitdiff
acme: ui: handle missing meta field in directory response
authorFolke Gleumes <f.gleumes@proxmox.com>
Mon, 22 Apr 2024 09:01:02 +0000 (11:01 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 22 Apr 2024 10:03:09 +0000 (12:03 +0200)
When none of the meta fields is set by the directory, the whole
dictionary is missing from the response, leading to an exception
when testing for fields inside it.

Reported-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Folke Gleumes <f.gleumes@proxmox.com>
Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>
www/manager6/node/ACME.js

index a0db51a6b5db8909a03f0a6773a9b5dc8268f685..7fe49171e3b7249033be070d880cf988bf3e9772 100644 (file)
@@ -150,15 +150,18 @@ Ext.define('PVE.node.ACMEAccountCreate', {
                                    directory: value,
                                },
                                success: function(response, opt) {
-                                   if (response.result.data.termsOfService) {
+                                   if (response.result.data && response.result.data.termsOfService) {
                                        field.setValue(response.result.data.termsOfService);
                                        disp.setValue(response.result.data.termsOfService);
                                        checkbox.setHidden(false);
                                    } else {
-                                       checkbox.setValue(false);
+                                       // Needed to pass input verification and enable register button
+                                       // has no influence on the submitted form
+                                       checkbox.setValue(true);
                                        disp.setValue("No terms of service agreement required");
                                    }
-                                   vm.set('eabRequired', !!response.result.data.externalAccountRequired);
+                                   vm.set('eabRequired', !!(response.result.data &&
+                                       response.result.data.externalAccountRequired));
                                },
                                failure: function(response, opt) {
                                    disp.setValue(undefined);