diff --git a/WiFiManager.cpp b/WiFiManager.cpp index 6bc96708..efeb83e5 100644 --- a/WiFiManager.cpp +++ b/WiFiManager.cpp @@ -2422,7 +2422,7 @@ void WiFiManager::handleNotFound() { */ boolean WiFiManager::captivePortal() { - if(!_enableCaptivePortal) return false; // skip redirections, @todo maybe allow redirection even when no cp ? might be useful + if(!_enableCaptivePortal || !configPortalActive) return false; // skip redirections if cp not enabled or not in ap mode String serverLoc = toStringIp(server->client().localIP()); diff --git a/WiFiManager.h b/WiFiManager.h index f5c7ae3d..c4c8be55 100644 --- a/WiFiManager.h +++ b/WiFiManager.h @@ -767,8 +767,15 @@ class WiFiManager boolean abort = false; boolean reset = false; boolean configPortalActive = false; + + + // these are state flags for portal mode, we are either in webportal mode(STA) or configportal mode(AP) + // these are mutually exclusive as STA+AP mode is not supported due to channel restrictions and stability + // if we decide to support this, these checks will need to be replaced with something client aware to check if client origin is ap or web + // These state checks are critical and used for internal function checks boolean webPortalActive = false; boolean portalTimeoutResult = false; + boolean portalAbortResult = false; boolean storeSTAmode = true; // option store persistent STA mode in connectwifi int timer = 0; // timer for debug throttle for numclients, and portal timeout messages