ratgdo / mqtt-ratgdo

ratgdo via mqtt
GNU General Public License v2.0
85 stars 20 forks source link

Long Wi-Fi passwords truncated when entering configuration page #61

Open pfurrie opened 10 months ago

pfurrie commented 10 months ago

Version 2.56 and 2.57

After flashing ratgdo with firmware, the user is asked to enter a network and password. I do that, and after a few moments I'm taken to the configuration page where I can enter all the other settings for the device. Good so far...

I enter all the info and click the "Save Config & Reboot" button, and it dutifully clears the page and shows "Success: rebooting the microcontroller using your credentials." And that's it. Now I can't ping the device at the IP it had, can't re-access it using the browser.

Re-flash and device and try again, same problem. Finally figure out that when the configuration page comes up, the listed Wi-Fi password is too short. It is only showing 47 of the 63 characters of my Wi-Fi password. If I re-enter my Wi-Fi password and save, then I can get back to the device, as it can keep communicating over Wi-Fi... because it has the correct Wi-Fi password. What was apparently happening was it was losing connection to the network as it was re-saving the truncated password and then was lost until it was re-flashed.

I've tested using a 47-character password (first 47 of my existing password), and it works fine without the need to re-enter the password on the configuration page. And the password field on the configuration page can accept 63 characters if I copy-and-paste or manually enter it, but just doesn't get auto-filled correctly when re-opening the configuration page.

I presume this is just due to length, not the make-up of my password.

pfurrie commented 10 months ago

Update: After a LOT of additional testing, I've found the culprit: the apostrophe in my Wi-Fi password is causing the issue. Remove the apostrophe, and the problem goes away -- actually, I have two apostrophes in the password, but the first apostrophe is where it breaks when retrieving the password to fill in the Wi-Fi password field on the configuration page.

Really don't want to change our Wi-Fi password. All of our Wi-Fi devices use it and it is a big pain to change for even one of them, let alone all of them. The apostrophe is a valid Wi-Fi password character. And ratgdo uses the password fine for communication, it is just the configuration page that is a bit problematic in this case.