[pve-devel] [PATCH manager] acme: ui: handle missing meta field in directory response

Folke Gleumes f.gleumes at proxmox.com
Mon Apr 22 11:08:18 CEST 2024


Forgot the reported by trailer:

Reported-by: Stoiko Ivanov <s.ivanov at proxmox.com>

On Mon, 2024-04-22 at 11:01 +0200, Folke Gleumes wrote:
> 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.
> 
> Signed-off-by: Folke Gleumes <f.gleumes at proxmox.com>
> ---
>  www/manager6/node/ACME.js | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/www/manager6/node/ACME.js b/www/manager6/node/ACME.js
> index a0db51a6..7fe49171 100644
> --- a/www/manager6/node/ACME.js
> +++ b/www/manager6/node/ACME.js
> @@ -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.resul
> t.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.external
> AccountRequired));
>                                 },
>                                 failure: function(response, opt) {
>                                     disp.setValue(undefined);



More information about the pve-devel mailing list