mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Add password length check
Also remove most of the rest of the javascript as it is unused.
This commit is contained in:
parent
e953e68556
commit
b353dd77a8
87
dist/js/functions.js
vendored
87
dist/js/functions.js
vendored
@ -1,82 +1,9 @@
|
||||
function WiFiDown() {
|
||||
var down = confirm("Take down wlan0 ?");
|
||||
if(down) {
|
||||
} else {
|
||||
alert("Action cancelled");
|
||||
}
|
||||
}
|
||||
|
||||
function UpdateNetworks() {
|
||||
var existing = document.getElementById("networkbox").getElementsByTagName('div').length;
|
||||
document.getElementById("Networks").value = existing;
|
||||
}
|
||||
|
||||
function AddNetwork() {
|
||||
// existing = document.getElementById("networkbox").getElementsByTagName('div').length;
|
||||
// existing++;
|
||||
Networks++
|
||||
var Networks = document.getElementById('Networks').value;
|
||||
document.getElementById('networkbox').innerHTML += '<div id="Networkbox'+Networks+'" class="Networkboxes"><div class="row"><div class="col-lg-12"><h4>Network '+Networks+'</h4> \
|
||||
<div class="row"><div class="form-group col-md-4"><label for="code">SSID</label><input type="text" class="form-control" name="ssid'+Networks+'" onkeyup="CheckSSID(this)"></div></div> \
|
||||
<div class="row"><div class="form-group col-md-4"><label for="code">PSK</label><input type="password" class="form-control" name="psk'+Networks+'" onkeyup="CheckPSK(this)"></div></div> \
|
||||
<div class="row"><div class="form-group col-md-4"><input type="button" class="btn btn-outline btn-primary" value="Cancel" onClick="DeleteNetwork('+Networks+')" /></div></div>';
|
||||
Networks++;
|
||||
document.getElementById('Networks').value=Networks;
|
||||
|
||||
}
|
||||
|
||||
function AddScanned(network, open = false) {
|
||||
|
||||
existing = document.getElementById("networkbox").getElementsByTagName('div').length;
|
||||
var Networks = document.getElementById('Networks').value;
|
||||
//if(existing != 0) {
|
||||
Networks++;
|
||||
//}
|
||||
|
||||
document.getElementById('Networks').value=Networks;
|
||||
document.getElementById('networkbox').innerHTML += '<div id="Networkbox'+Networks+'" class="Networkboxes"><div class="col-lg-12"><h4>Network '+Networks+'</h4>';
|
||||
document.getElementById('networkbox').innerHTML += '<div class="row"><div class="form-group col-md-4"><label for="code">SSID</</label><input type="text" class="form-control" name="ssid'+Networks+'" id="ssid'+Networks+'" onkeyup="CheckSSID(this)"></div></div>';
|
||||
|
||||
if ( open ) {
|
||||
document.getElementById('networkbox').innerHTML += '<input type="hidden" name="protocol'+Networks+'" value="Open">';
|
||||
document.getElementById('Save').disabled = false;
|
||||
} else {
|
||||
document.getElementById('networkbox').innerHTML += '<input type="hidden" name="protocol'+Networks+'" value="WPA">';
|
||||
document.getElementById('networkbox').innerHTML += '<div class="row"><div class="form-group col-md-4"><label for="code">PSK</label><input type="password" class="form-control" name="psk'+Networks+'" onkeyup="CheckPSK(this)"></div></div>';
|
||||
}
|
||||
|
||||
document.getElementById('networkbox').innerHTML += '<div class="row"><div class="form-group col-md-4"><input type="button" class="btn btn-outline btn-primary" value="Cancel" onClick="DeleteNetwork('+Networks+')" /></div></div>';
|
||||
document.getElementById('ssid'+Networks).value = network;
|
||||
if(existing == 0) {
|
||||
Networks++
|
||||
document.getElementById('Networks').value = Networks;
|
||||
function CheckPSK(psk, id) {
|
||||
if(psk.value.length < 8 || psk.value.length > 63) {
|
||||
psk.style.background='#FFD0D0';
|
||||
document.getElementById(id).disabled = true;
|
||||
} else {
|
||||
psk.style.background='#D0FFD0';
|
||||
document.getElementById(id).disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
function CheckSSID(ssid) {
|
||||
if(ssid.value.length>31) {
|
||||
ssid.style.background='#FFD0D0';
|
||||
document.getElementById('Save').disabled = true;
|
||||
} else {
|
||||
ssid.style.background='#D0FFD0'
|
||||
document.getElementById('Save').disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
function CheckPSK(psk) {
|
||||
if(psk.value.length < 8) {
|
||||
psk.style.background='#FFD0D0';
|
||||
document.getElementById('Save').disabled = true;
|
||||
} else {
|
||||
psk.style.background='#D0FFD0';
|
||||
document.getElementById('Save').disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
function DeleteNetwork(network) {
|
||||
element = document.getElementById('Networkbox'+network);
|
||||
element.parentNode.removeChild(element);
|
||||
var Networks = document.getElementById('Networks').value;
|
||||
Networks--
|
||||
document.getElementById('Networks').value = Networks;
|
||||
}
|
||||
|
@ -174,14 +174,14 @@ function DisplayWPAConfig(){
|
||||
<?php if ($network['protocol'] === 'Open') { ?>
|
||||
<td><input type="hidden" name="passphrase<?php echo $index ?>" value="" />---</td>
|
||||
<?php } else { ?>
|
||||
<td><input type="text" class="form-control" name="passphrase<?php echo $index ?>" value="<?php echo $network['passphrase'] ?>" />
|
||||
<td><input type="text" class="form-control" name="passphrase<?php echo $index ?>" value="<?php echo $network['passphrase'] ?>" onKeyUp="CheckPSK(this, 'update<?php echo $index?>')" />
|
||||
<?php } ?>
|
||||
<td>
|
||||
<div class="btn-group btn-block">
|
||||
<?php if ($network['configured']) { ?>
|
||||
<input type="submit" class="col-md-6 btn btn-warning" value="Update" name="update<?php echo $index ?>"<?php echo ($network['protocol'] === 'Open' ? ' disabled' : '')?> />
|
||||
<input type="submit" class="col-md-6 btn btn-warning" value="Update" id="update<?php echo $index ?>" name="update<?php echo $index ?>"<?php echo ($network['protocol'] === 'Open' ? ' disabled' : '')?> />
|
||||
<?php } else { ?>
|
||||
<input type="submit" class="col-md-6 btn btn-info" value="Add" name="update<?php echo $index ?>" />
|
||||
<input type="submit" class="col-md-6 btn btn-info" value="Add" id="update<?php echo $index ?>" name="update<?php echo $index ?>" <?php echo ($network['protocol'] === 'Open' ? '' : ' disabled')?> />
|
||||
<?php } ?>
|
||||
<input type="submit" class="col-md-6 btn btn-danger" value="Delete" name="delete<?php echo $index ?>"<?php echo ($network['configured'] ? '' : ' disabled')?> />
|
||||
</div>
|
||||
@ -192,7 +192,7 @@ function DisplayWPAConfig(){
|
||||
</table>
|
||||
</form>
|
||||
</div><!-- ./ Panel body -->
|
||||
<div class="panel-footer"><strong>Note,</strong> WEP access points will appear as 'Open'. RaspAP does not currently support connecting to WEP.</div>
|
||||
<div class="panel-footer"><strong>Note,</strong> WEP access points appear as 'Open'. RaspAP does not currently support connecting to WEP.</div>
|
||||
</div><!-- /.panel-primary -->
|
||||
</div><!-- /.col-lg-12 -->
|
||||
</div><!-- /.row -->
|
||||
|
Loading…
Reference in New Issue
Block a user