Skip to content

Commit

Permalink
add 63 char limit and other fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-moody committed Aug 12, 2024
1 parent 4f4399c commit 2d6ba72
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions roles/console/files/js/admin_console.js
Original file line number Diff line number Diff line change
Expand Up @@ -992,13 +992,25 @@ function controlWifi(){

function controlWifiHotspot(){
var cmd_args = {};
if (serverInfo.hostapd_status == 'ON'){
cmd_args['hotspot_passord'] = gEBI('hotspot_wifi_password_UD').value;
if (serverInfo.hostapd_status == 'ON') {
var hotspotPassword = gEBI('hotspot_wifi_password_UD').value;
if (hotspotPassword.length < 8 || hotspotPassword.length > 63) {
alert("WiFi password must be between 8 and 63 printable characters.");
return
}
for (let i = 0; i < hotspotPassword.length; i++) {
let charCode = hotspotPassword.charCodeAt(i);
if (charCode < 32 || charCode > 126){
alert("Password cannot contain the character '" + hotspotPassword[i] + "'")
return
}
}
cmd_args['hotspot_passord'] = hotspotPassword;
var command = "CTL-HOTSPOT " + JSON.stringify(cmd_args);
return sendCmdSrvCmd(command, genericCmdHandler, "HOSTSPOT-CTL");
}
else
alert ("Can't change password as Internal Hotspot is not ON.");
alert("Can't change password as Internal Hotspot is not ON.");
}

function setWifiConnectionParams(){
Expand Down

0 comments on commit 2d6ba72

Please sign in to comment.