In order to make the project more stable and reliable, ESP8266/Arduino programming recommends avoiding String objects to prevent a memory leak. Is there any idea to replace String objects to char *?
String newPasswordString; //hold the new password char newPassword[6]; //charater string of newPasswordString //initialize password to 1234 //you can use password.set ...