@@ -77,7 +77,7 @@ void setup(void) {
7777 html += " <h2>Reset Configuration?</h2>" ;
7878 html += " <p>Are you sure you want to reset the WiFi configuration? This will clear current WiFi settings and restart the device in AP mode.</p>" ;
7979 html += " <form method='POST' style='display:inline;' accept-charset='UTF-8'>" ;
80- if (preferences. isKey ( " reset_password" ) && preferences. getString ( " reset_password" ).length () > 0 ) {
80+ if (reset_password != nullptr && String ( reset_password).length () > 0 ) {
8181 html += " <input type='password' name='reset_password' placeholder='Enter reset password' required><br/>" ;
8282 }
8383 html += " <button type='submit' class='btn btn-yes'>Yes, Reset</button>" ;
@@ -88,10 +88,9 @@ void setup(void) {
8888 });
8989
9090 server.on (" /reset" , AsyncWebRequestMethod::HTTP_POST, [](AsyncWebServerRequest *request) {
91- if (preferences. isKey ( " reset_password" ) && preferences. getString ( " reset_password" ).length () > 0 ) {
91+ if (reset_password != nullptr && String ( reset_password).length () > 0 ) {
9292 if (request->hasParam (" reset_password" , true )) {
93- String resetPassword = request->getParam (" reset_password" , true )->value ();
94- if (resetPassword == preferences.getString (" reset_password" )) {
93+ if (String (reset_password) == request->getParam (" reset_password" , true )->value ()) {
9594 shouldResetConfig = true ;
9695 request->send (200 , " text/plain" , " Resetting WiFi configuration, please log back into the hotspot to reconfigure...\r\n " );
9796 } else {
0 commit comments