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 2DF851FF0C1 for ; Tue, 25 Aug 2026 10:09:58 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B89AA21709; Tue, 25 Aug 2026 10:09:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=azharul.com; s=t28hkp5; t=1787283742; x=1787888542; darn=lists.proxmox.com; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=q5Fsu50pJHtUNf8RlOso9V6cJ8TLDQilHrUwFWc+4T4=; b=A1F0QbJcaievevfk6pBDppETEe6DQW/Yj5gSw/3XEvnRAiGbA2vjLO8hbWquCn5eVQ QcTIFj1b/FbU1//cI/A64arYLBmCCWsbvx5CA/5Q0a+LhVg4f7GN2LS8cS9yEZIdnd4T xUxPhxp1IhKaA43OI+YbmxSlUO2AdBD0v8mXJ3/n6b1ay+yBolzOvQiF6nrxPHaZH6M3 nG5TtoqkInxKh1wvXmYEmjiLoOf160jtiVQlJRhYv1lINL5pLuL6JdIq9z5cYoX4KQ/d nXndhhvrP5ks7gFoT7P1rpgjjro2cMaJJhSzvltBWBZhlfWh4nnnbaOkOHvnnKj9NhOE maZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787283742; x=1787888542; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=q5Fsu50pJHtUNf8RlOso9V6cJ8TLDQilHrUwFWc+4T4=; b=Rj/xhtVgbt0Q/dOfAmlSa9YLSfbXuJHb4oA7C2PrrCsgkJxFR5FQlBJC6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++dafKL4Rs07esbHEfpJb+UdaThALPDAvQ== X-Received: by 2002:a05:620a:15a3:b0:937:2fdf:2915 with SMTP id af79cd13be357-93739537a7cmr227592785a.25.1787283742340; Thu, 20 Aug 2026 20:42:22 -0700 (PDT) From: Azharul Haque To: pve-devel@lists.proxmox.com Subject: [PATCH login-manager v3 5/5] fix #4281: ui: fix stale Continue button state on realm switch Date: Thu, 20 Aug 2026 23:41:44 -0400 Message-ID: <20260821034147.30194-8-haque@azharul.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260821034147.30194-1-haque@azharul.com> References: <20260810144713.75806-1-haque@azharul.com> <20260821034147.30194-1-haque@azharul.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.256 Adjusted score from AWL reputation of From: address DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record X-MailFrom: haque@azharul.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation Message-ID-Hash: RIDP2VP25AQZNPDT7Q5ECDKUJ4J2DMYC X-Message-ID-Hash: RIDP2VP25AQZNPDT7Q5ECDKUJ4J2DMYC X-Mailman-Approved-At: Tue, 25 Aug 2026 10:08:31 +0200 CC: haque@azharul.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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(+) diff --git a/lib/proxmox_login_form.dart b/lib/proxmox_login_form.dart index 1a94445..a634908 100644 --- a/lib/proxmox_login_form.dart +++ b/lib/proxmox_login_form.dart @@ -439,6 +439,31 @@ class _ProxmoxLoginPageState extends State { setState(() { _selectedDomain = value; }); + // The Form's onChanged callback validates + // against whatever fields are mounted at + // the moment the dropdown's own value + // changes, which runs before this rebuild + // adds/removes the username/password + // fields for the newly selected realm. + // Recompute once that rebuild has + // happened so we validate the field set + // that's actually showing. + if (value?.isOpenIdRealm == true) { + setState(() { + _submitButtonEnabled = true; + }); + } else { + WidgetsBinding.instance + .addPostFrameCallback((_) { + if (!mounted) return; + setState(() { + _submitButtonEnabled = _formKey + .currentState + ?.validate() ?? + false; + }); + }); + } }, onOriginSubmitted: () { final isValid = @@ -868,6 +893,9 @@ class _ProxmoxLoginPageState extends State { setState(() { _progressModel.inProgress -= 1; _selectedDomain = 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 = selection?.isOpenIdRealm == true; }); return response; -- 2.50.1 (Apple Git-155)