From 26fbd78156860bc857c13b285f0bf90c704ed8ec Mon Sep 17 00:00:00 2001 From: glaszig Date: Mon, 19 Aug 2019 02:28:48 +0100 Subject: [PATCH] replaced CheckPSK dom level 1 events with level 2 event listener-driven implementation --- js/custom.js | 13 +++++++++++++ templates/wifi_stations.php | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/js/custom.js b/js/custom.js index b938556d..6fd77882 100644 --- a/js/custom.js +++ b/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) diff --git a/templates/wifi_stations.php b/templates/wifi_stations.php index 1c2b7542..7d4f48fa 100644 --- a/templates/wifi_stations.php +++ b/templates/wifi_stations.php @@ -67,7 +67,7 @@ - +