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 39B921FF0E1 for ; Mon, 10 Aug 2026 14:36:55 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id B031C21745; Mon, 10 Aug 2026 14:36:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=azharul.com; s=t28hkp5; t=1786340393; x=1786945193; 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=sk2iOexZGbeqrKmN67Eb6az6ZUGYRNRWm5lO4Ieab0E=; b=QbkfgC9hR5zfJz6WEW6V/Kp6zfl1crtn/6EkKYXqBCwfVUTwv3vQAsJNkJn6IOJdyJ nCRtp9KFTPc0jDa7V+pWKOJ4zxWzGwkknWHjEWbTrfXjsK7uHhc2oIsRhp43xlFui4Ry gOR3neHbGs9cnqg6V5+JcicKb0/odI1tAMwvnCFHMfHpMJkOYTZ6KG+nkW/CW7o5kHi+ dqOJPFuUS48IyG+LqBcZRWw6HPhUXPToDBBue3xNmJlUK5AKbgnPSqvq81jk4oV9J1j5 3OLoNMJDNxCP/cFqkDz1zl3V13dz4A9McBosuGeYcVAjuQmJ+7oSoWgKCbe49I3SZurg B0IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786340393; x=1786945193; 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=sk2iOexZGbeqrKmN67Eb6az6ZUGYRNRWm5lO4Ieab0E=; b=r1WfTTqxfwSneWAcc6YZ4yV7kXYu/k7zLBpQ8enb562R91vD1oa8zrtkia83I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zUKBdUqBXy9V0w3nN3QZSURHRSnbCZzsrqdF5uGdsKbTmO/wTusmBcR6FrlFTz y2KjqQVdU3kqBuxf9Aw26a8dNGRo9UrKZpSjhFA== X-Received: by 2002:a05:620a:2620:b0:915:b852:4361 with SMTP id af79cd13be357-9367979c776mr1720027985a.20.1786340393085; Sun, 09 Aug 2026 22:39:53 -0700 (PDT) From: Azharul Haque To: pve-devel@lists.proxmox.com Subject: [PATCH 2/3] fix #4281: ui: fix stale Continue button state on realm switch Date: Mon, 10 Aug 2026 01:39:40 -0400 Message-ID: <20260810053941.17000-3-haque@azharul.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260810053941.17000-1-haque@azharul.com> References: <20260810053941.17000-1-haque@azharul.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.235 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: GWAFZJCUFSEAAKFYTZKZWQMIMYV33RPR X-Message-ID-Hash: GWAFZJCUFSEAAKFYTZKZWQMIMYV33RPR X-Mailman-Approved-At: Mon, 10 Aug 2026 14:36:15 +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 b73165c..002838c 100644 --- a/lib/proxmox_login_form.dart +++ b/lib/proxmox_login_form.dart @@ -396,6 +396,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 = @@ -828,6 +853,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)