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 CC5221FF0EA for ; Thu, 13 Aug 2026 17:59:06 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id CAA12219EF; Thu, 13 Aug 2026 17:58:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=azharul.com; s=t28hkp5; t=1786373275; x=1786978075; 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=eFElz2+Tf+t9mNmGowK1MrppgiiZHi6rv0IGa7K3XdJ9KMIoczwObOadJn6ck2tD2H s2Lo0Q96grUIJMaEXWhiLoIXxKZPtdqPGaOifvfVexGUYM05FRlnMOlsbR5eUj5tyloI xPMqp0zK98moTQ4Zra7+BZZhwu82O8KRdJIDoLTmI2z61Lte+U7ZONAGJ0Ykr19zN0O0 HNDJt/MYqISFqIiazqn8dxvsrFm0jQnhfpriztxjBC4XjE5PrDXGNati/tLWkp3//Tbb yFy8Au7Bv9kQd1dbZDShrPfMrAu9fNSxX8uECZaf+DpIkDGaML5s3YsaLDQkiNz0eoOX 1YpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786373275; x=1786978075; 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=X1hQaYb2R6SeY0ybnkMHZD1JsSiPcHJT8SXZC9+xMOhNU15ZMOZHAPS/SFfkegBI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WjscICd+vERtzPmT3Bk5To5xWhM52iGQ9KZVUkvGmklJ w8bU9qvnYhRgConQawoGRqMSJuJg= X-Received: by 2002:a05:620a:28ce:b0:934:9011:596c with SMTP id af79cd13be357-9369d081c6amr248210085a.24.1786373274819; Mon, 10 Aug 2026 07:47:54 -0700 (PDT) From: Azharul Haque To: pve-devel@lists.proxmox.com Subject: [PATCH login-manager v2 2/3] fix #4281: ui: fix stale Continue button state on realm switch Date: Mon, 10 Aug 2026 10:47:10 -0400 Message-ID: <20260810144713.75806-5-haque@azharul.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260810144713.75806-1-haque@azharul.com> References: <20260810144713.75806-1-haque@azharul.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.177 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: 6KTZ7OWONOBGWIJUVWGHKCDTADSHPR5U X-Message-ID-Hash: 6KTZ7OWONOBGWIJUVWGHKCDTADSHPR5U X-Mailman-Approved-At: Thu, 13 Aug 2026 17:58:30 +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)