MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / wifiHandler

Function wifiHandler

src/webInterface.cpp:907–933  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

905}
906
907esp_err_t wifiHandler(httpd_req_t *req) {
908 if (!checkUserWebAuth(req)) return ESP_OK;
909 String usr = queryValue(req, "usr");
910 String pwdd = queryValue(req, "pwd");
911 if (!usr.isEmpty() && !pwdd.isEmpty()) {
912 wui_pwd = pwdd;
913 wui_usr = usr;
914 saveConfigs();
915 config.httpuser = usr;
916 config.httppassword = pwdd;
917 sendText(req, "text/plain", "User: " + String(ssid) + " configured with password: " + String(pwd));
918 return ESP_OK;
919 }
920
921 String ssidd = queryValue(req, "ssid");
922 if (!ssidd.isEmpty() && !pwdd.isEmpty()) {
923 pwd = pwdd;
924 ssid = ssidd;
925 if (setWifiCredential(ssid, pwd)) {
926 saveConfigs();
927 } else {
928 launcherConsolePrintln("WebUI: failed to store new WiFi entry");
929 }
930 }
931 sendText(req, "text/plain", "OK");
932 return ESP_OK;
933}
934
935esp_err_t fallbackHandler(httpd_req_t *req) {
936 redirectTo(req, "/");

Callers

nothing calls this directly

Calls 6

checkUserWebAuthFunction · 0.85
queryValueFunction · 0.85
saveConfigsFunction · 0.85
sendTextFunction · 0.85
setWifiCredentialFunction · 0.85
launcherConsolePrintlnFunction · 0.85

Tested by

no test coverage detected