Captive form should percent-encode parameters for POST request
osks opened this issue · 1 comments
osks commented
I had a problem with connecting to the wifi and I discovered that it was because the form parameters are not correctly encoded before put in the POST request. My wifi password had some character that needed to be encoded to work. It worked when I manually encoded it using encodeURIComponent() and entered the encoded value into the form.
In the file data/captive/app.js these lines:
var params = "ssid=" + document.getElementsByName("ssid")[0].value +
"&ssidPassword=" + document.getElementsByName("ssidPassword")[0].value +
"&loginName=" + document.getElementsByName("loginName")[0].value +
"&loginPassword=" + document.getElementsByName("loginPassword")[0].value
should be:
var params = "ssid=" + encodeURIComponent(document.getElementsByName("ssid")[0].value) +
"&ssidPassword=" + encodeURIComponent(document.getElementsByName("ssidPassword")[0].value) +
"&loginName=" + encodeURIComponent(document.getElementsByName("loginName")[0].value) +
"&loginPassword=" + encodeURIComponent(document.getElementsByName("loginPassword")[0].value);
sieren commented
Great catch! Thank you for the proposal too! Merging into master and will be fixed in the next release :)