Skip to content

Commit

Permalink
[SYS] Avoid AP generation if no WiFi and config already entered (#1888)
Browse files Browse the repository at this point in the history
For security reason do not generate an Access Point if the configuration has been entered and if the WiFi is not detected at start
  • Loading branch information
1technophile authored Feb 7, 2024
1 parent 60a571e commit c70590f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions main/main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1835,6 +1835,16 @@ void setup_wifimanager(bool reset_settings) {
//set minimum quality of signal so it ignores AP's under that quality
wifiManager.setMinimumSignalQuality(MinimumWifiSignalQuality);

if (SPIFFS.begin()) {
Log.trace(F("mounted file system" CR));
// Check if the config file exists and prevent the portal from showing if yes
// Showing the portal if the config file exist would enable access to the configuration data and to the ESP update page
// This is a security risk if an attacker has access to the gateway password
if (SPIFFS.exists("/config.json")) {
wifiManager.setEnableConfigPortal(false);
}
}

# ifdef ESP32_ETHERNET
wifiManager.setBreakAfterConfig(true); // If ethernet is used, we don't want to block the connection by keeping the portal up
# endif
Expand Down

0 comments on commit c70590f

Please sign in to comment.