From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id DC6951FF0C1 for ; Wed, 26 Aug 2026 12:24:56 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 8D559213A7; Wed, 26 Aug 2026 12:24:56 +0200 (CEST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 26 Aug 2026 12:24:52 +0200 Message-Id: To: "Azharul Haque" , Subject: Re: [PATCH login-manager v3 5/5] fix #4281: ui: fix stale Continue button state on realm switch From: "Shan Shaji" X-Mailer: aerc 0.20.0 References: <20260810144713.75806-1-haque@azharul.com> <20260821034147.30194-1-haque@azharul.com> <20260821034147.30194-8-haque@azharul.com> In-Reply-To: <20260821034147.30194-8-haque@azharul.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1787739861318 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.536 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 7OWL3AGCUDJ6KLDNSSVJLMRCPTUBZ6FD X-Message-ID-Hash: 7OWL3AGCUDJ6KLDNSSVJLMRCPTUBZ6FD X-MailFrom: s.shaji@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri Aug 21, 2026 at 5:41 AM CEST, Azharul Haque wrote: > Form(onChanged: ...) revalidates against whatever fields are > currently mounted at the moment a FormField's own value changes. > For the realm dropdown that runs before the following rebuild > adds/removes the username/password fields for the newly selected > realm's type, so Continue got enabled/disabled based on the > outgoing realm's field set rather than the incoming one. Most > visibly, switching from an OpenID realm to a password realm left > Continue enabled with both fields empty, only failing validation > once actually pressed. > > Recompute _submitButtonEnabled explicitly in onDomainChanged instead: > OpenID realms have nothing to validate, so enable it directly; other > realms are revalidated in a post-frame callback once the rebuild has > settled. Do the same after the initial realm auto-selection in > _getAccessDomains(), in case the default realm is an OpenID one. > > Signed-off-by: Azharul Haque > --- > lib/proxmox_login_form.dart | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) [snip] > @@ -868,6 +893,9 @@ class _ProxmoxLoginPageState extends State { > setState(() { > _progressModel.inProgress -=3D 1; > _selectedDomain =3D selection; > + // An OpenID realm has no username/password to fill in, so there's > + // nothing for the form to validate before Continue is usable. > + _submitButtonEnabled =3D selection?.isOpenIdRealm =3D=3D true; If I fill in the origin field and the SSL validation enabled, then press th= e Continue button, the dialog is shown and the Continue button becomes disabled. I have to edit the field again to re-enable the Continue button, even though the form is valid. That is, if selection is null, the button becomes disabled. As I understand it, we also need to check whether selection is null before setting the button state here: ``` if (selection !=3D null) { _submitButtonEnabled =3D selection!.isOpenIdRealm =3D=3D true; } ``` Why use an if block instead of an inline check? Otherwise, the submitButtonEnabled state variable is assigned false, which notifies the framework that the object=E2=80=99s internal state has changed and needs to= be rebuilt. Because of this rebuild, the button becomes disabled. > }); > > return response;