| 905 | } |
| 906 | |
| 907 | esp_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 | |
| 935 | esp_err_t fallbackHandler(httpd_req_t *req) { |
| 936 | redirectTo(req, "/"); |
nothing calls this directly
no test coverage detected