public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] acme: ui: handle missing meta field in directory response
@ 2024-04-22  9:01 Folke Gleumes
  2024-04-22  9:06 ` Stoiko Ivanov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Folke Gleumes @ 2024-04-22  9:01 UTC (permalink / raw)
  To: pve-devel

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@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.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);
-- 
2.39.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH manager] acme: ui: handle missing meta field in directory response
  2024-04-22  9:01 [pve-devel] [PATCH manager] acme: ui: handle missing meta field in directory response Folke Gleumes
@ 2024-04-22  9:06 ` Stoiko Ivanov
  2024-04-22  9:08 ` Folke Gleumes
  2024-04-22 10:39 ` [pve-devel] applied: " Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Stoiko Ivanov @ 2024-04-22  9:06 UTC (permalink / raw)
  To: Folke Gleumes; +Cc: Proxmox VE development discussion

Gave this patch a spin against a quickly setup step-ca container I had
lying around - the issue of not being able to register an account without
EAB is gone with it.

Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>

On Mon, 22 Apr 2024 11:01:02 +0200
Folke Gleumes <f.gleumes@proxmox.com> 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@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.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);



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [pve-devel] [PATCH manager] acme: ui: handle missing meta field in directory response
  2024-04-22  9:01 [pve-devel] [PATCH manager] acme: ui: handle missing meta field in directory response Folke Gleumes
  2024-04-22  9:06 ` Stoiko Ivanov
@ 2024-04-22  9:08 ` Folke Gleumes
  2024-04-22 10:39 ` [pve-devel] applied: " Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Folke Gleumes @ 2024-04-22  9:08 UTC (permalink / raw)
  To: pve-devel

Forgot the reported by trailer:

Reported-by: Stoiko Ivanov <s.ivanov@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@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);

_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied: [PATCH manager] acme: ui: handle missing meta field in directory response
  2024-04-22  9:01 [pve-devel] [PATCH manager] acme: ui: handle missing meta field in directory response Folke Gleumes
  2024-04-22  9:06 ` Stoiko Ivanov
  2024-04-22  9:08 ` Folke Gleumes
@ 2024-04-22 10:39 ` Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2024-04-22 10:39 UTC (permalink / raw)
  To: Proxmox VE development discussion, Folke Gleumes

Am 22/04/2024 um 11:01 schrieb Folke Gleumes:
> 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@proxmox.com>
> ---
>  www/manager6/node/ACME.js | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
>

applied, thanks!

fwiw and just to have it noted, as this is pre-existing and so not the fault
of your EAB patches: this component could do well with some style rework,
manual IDs, split between viewModel and custom window.down('') querys +
change/disable/.. logic and quite a few intermediate variables that are only
used once.


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-22 10:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-22  9:01 [pve-devel] [PATCH manager] acme: ui: handle missing meta field in directory response Folke Gleumes
2024-04-22  9:06 ` Stoiko Ivanov
2024-04-22  9:08 ` Folke Gleumes
2024-04-22 10:39 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal