mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-21 23:20:22 +00:00
replaced CheckPSK dom level 1 events with level 2 event listener-driven implementation
This commit is contained in:
parent
611d953141
commit
26fbd78156
2 changed files with 14 additions and 1 deletions
13
js/custom.js
13
js/custom.js
|
@ -213,6 +213,19 @@ $(document).on("click", ".js-toggle-password", function(e) {
|
|||
}
|
||||
});
|
||||
|
||||
$(document).on("keyup", ".js-validate-psk", function(e) {
|
||||
var field = $(e.target);
|
||||
var colors = field.data("colors").split(",");
|
||||
var target = $(field.data("target"));
|
||||
if (field.val().length < 8 || field.val().length > 63) {
|
||||
field.css("backgroundColor", colors[0]);
|
||||
target.attr("disabled", true);
|
||||
} else {
|
||||
field.css("backgroundColor", colors[1]);
|
||||
target.attr("disabled", false);
|
||||
}
|
||||
});
|
||||
|
||||
$(document)
|
||||
.ajaxSend(setCSRFTokenHeader)
|
||||
.ready(contentLoaded)
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
<?php if ($network['protocol'] === 'Open') { ?>
|
||||
<input type="password" disabled class="form-control" aria-describedby="passphrase" name="passphrase<?php echo $index ?>" value="" />
|
||||
<?php } else { ?>
|
||||
<input type="password" class="form-control" aria-describedby="passphrase" name="passphrase<?php echo $index ?>" value="<?php echo $network['passphrase'] ?>" onKeyUp="CheckPSK(this, 'update<?php echo $index?>')" >
|
||||
<input type="password" class="form-control js-validate-psk" aria-describedby="passphrase" name="passphrase<?php echo $index ?>" value="<?php echo $network['passphrase'] ?>" data-target="#update<?php echo $index ?>" data-colors="#ffd0d0,#d0ffd0">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default js-toggle-password" type="button" data-target="[name=passphrase<?php echo $index ?>]" data-toggle-with="<?php echo _("Hide") ?>">Show</button>
|
||||
</span>
|
||||
|
|
Loading…
Reference in a new issue