[pve-devel] [PATCH proxmox_login_manager v3 1/1] fix #6409: add `isDefaultRealm` check to pre-select realm in login form

Shan Shaji s.shaji at proxmox.com
Tue Jun 3 14:20:36 CEST 2025


When the `default` property was selected inside the realm of the web
UI, the app's login page was not showing the default realm instead,
it was always showing PAM.

Add `isDefaultRealm` boolean check to find the default realm.
Also the user's selection will have priority if a realm is
already saved.

Signed-off-by: Shan Shaji <s.shaji at proxmox.com>
---

changes since v2:
* removed "this commit" string from commit message.
* fixed `StateError` in `singleWhere` function which can happen
  when both conditions are true.
* if a realm is already saved then that realm will have priority
  over default realm. 

lib/proxmox_login_form.dart | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/proxmox_login_form.dart b/lib/proxmox_login_form.dart
index 5916563..7728594 100644
--- a/lib/proxmox_login_form.dart
+++ b/lib/proxmox_login_form.dart
@@ -697,7 +697,9 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
     response?.sort((a, b) => a!.realm.compareTo(b!.realm));
 
     final selection = response?.singleWhere(
-      (e) => e!.realm == widget.userModel?.realm,
+      (e) => widget.userModel?.realm != null
+          ? e!.realm == widget.userModel?.realm
+          : e?.isDefaultRealm == true,
       orElse: () => response?.first,
     );
 
-- 
2.39.5





More information about the pve-devel mailing list