Add support for open networks to enduser_setup (#3392)

This commit is contained in:
Sébastien Roy 2024-02-05 01:11:48 -05:00 committed by GitHub
parent 76936d7ed3
commit 604bca01fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -832,11 +832,19 @@ static int enduser_setup_http_handle_credentials(char *data, unsigned short data
state->success = 0; state->success = 0;
state->lastStationStatus = 0; state->lastStationStatus = 0;
char *name_str = strstr(data, "wifi_ssid="); char *name_str = strstr(data, "wifi_ssid=");
char *pwd_str = strstr(data, "wifi_password="); char *pwd_str = strstr(data, "wifi_password=");
if (name_str == NULL || pwd_str == NULL)
// in case we dont get a passwd (for open networks)
if (pwd_str == NULL) {
pwd_str="wifi_password=";
ENDUSER_SETUP_DEBUG("No passord provided. Assuming open network");
}
if (name_str == NULL)
{ {
ENDUSER_SETUP_DEBUG("Password or SSID string not found"); ENDUSER_SETUP_DEBUG("SSID string not found");
return 1; return 1;
} }

View File

@ -54,6 +54,7 @@ Then the `eus_params.lua` file will contain the following:
```lua ```lua
-- those wifi_* are the base parameters that are saved anyway -- those wifi_* are the base parameters that are saved anyway
-- if network is open, then there is no wifi_password
local p = {} local p = {}
p.wifi_ssid="ssid" p.wifi_ssid="ssid"
p.wifi_password="password" p.wifi_password="password"