Sorry, can't use ' or " or space.

This commit is contained in:
zogodo
2019-09-29 23:54:53 +08:00
parent af383158d1
commit 19da61cfa6
4 changed files with 31 additions and 17 deletions

View File

@@ -310,11 +310,30 @@ function ChangeInput(type) {
}
}
function SubmitNetwork() {
if(mode == 1) {
//Quotation Marks
function ContainQM(str) {
if (str.indexOf("'") >= 0
|| str.indexOf('"') >= 0
|| str.indexOf(' ') >= 0
|| str.length > 32) {
return true;
}
return false;
}
var qm_mess = "Sorry, can't use ' or \" or space.\n\nAlso, length <= 32."
function SubmitNetwork() {
if(mode != 1) {
if (ContainQM(ap_name) || ContainQM(ap_pswd)) {
alert(qm_mess);
return;
}
} else {
var params = "ssid="+station_name+"&key="+station_pswd;
if (ContainQM(station_name) || ContainQM(station_pswd)) {
alert(qm_mess);
return;
}
var params = station_name+" "+station_pswd;
HttpPost("/wifi/config", function (re) {
alert(re);
}, params);