Skip to content

Commit

Permalink
fix(setup): Persist password to NVS + correct text
Browse files Browse the repository at this point in the history
  • Loading branch information
Slider0007 committed Oct 13, 2024
1 parent 668d087 commit 5dc1aa0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion code/components/webserver_softap/softAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ esp_err_t main_handler_AP(httpd_req_t *req)
message += "xhttp.onreadystatechange = function() {if (xhttp.readyState == 4) {if (xhttp.status == 200) {location.reload();}}};";
message += "let filePath = document.getElementById(\"newfile\").value.split(/[\\\\/]/).pop();";
message += "let file = document.getElementById(\"newfile\").files[0];";
message += "if (!file.name.includes(\"remote-setup\")){if (!confirm(\"The zip file name should contain '...remote-setup...'. ";
message += "if (!file.name.includes(\"AI-on-the-edge-device__\")){if (!confirm(\"The zip file name should contain 'AI-on-the-edge-device__...'. ";
message += "Are you sure that you have downloaded the correct file?\"))return;};";
message += "let upload_path = \"/upload/firmware/\" + filePath; xhttp.open(\"POST\", upload_path, true); xhttp.send(file);";
message += "document.getElementById(\"doUpdate\").disabled = true;}";
Expand Down Expand Up @@ -145,6 +145,7 @@ esp_err_t config_handler_AP(httpd_req_t *req)

if (httpd_query_key_value(query, "pwd", valuechar, sizeof(valuechar)) == ESP_OK) {
ConfigClass::getInstance()->cfgTmp()->sectionNetwork.wlan.password = urlDecode(std::string(valuechar));
ConfigClass::getInstance()->saveMigDataToNVS("wlan_pw", ConfigClass::getInstance()->cfgTmp()->sectionNetwork.wlan.password);
}
}
ConfigClass::getInstance()->persistConfig();
Expand Down

0 comments on commit 5dc1aa0

Please sign in to comment.