From bb7d1d7d8503150cf403c1f2ee096dfaa9c98a14 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 13 Feb 2026 01:54:15 -0800 Subject: [PATCH] Auth: de-spam realm list requests in UI-driven flow --- src/auth/auth_handler.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/auth/auth_handler.cpp b/src/auth/auth_handler.cpp index 489c0bb5..a0a2f631 100644 --- a/src/auth/auth_handler.cpp +++ b/src/auth/auth_handler.cpp @@ -73,7 +73,12 @@ void AuthHandler::requestRealmList() { return; } - if (state != AuthState::AUTHENTICATED) { + // Allow callers (UI) to be dumb and call this repeatedly; we gate on state. + // After auth success we may already be in REALM_LIST_REQUESTED / REALM_LIST_RECEIVED. + if (state == AuthState::REALM_LIST_REQUESTED) { + return; + } + if (state != AuthState::AUTHENTICATED && state != AuthState::REALM_LIST_RECEIVED) { LOG_ERROR("Cannot request realm list: not authenticated (state: ", (int)state, ")"); return; }