From f63c4688bcd0e2fba8ff2128bda0763d2aef4386 Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 27 Feb 2020 17:21:57 +0000 Subject: [PATCH] Update with click handler, genPassword() --- app/js/custom.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/js/custom.js b/app/js/custom.js index 76247d11..1923b38d 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -143,6 +143,16 @@ $(document).on("submit", ".js-dhcp-settings-form", function(e) { $(".js-add-dhcp-static-lease").trigger("click"); }); +$(document).on("click", "#gen_wpa_passphrase", function(e) { + $('#txtwpapassphrase').val(genPassword(63)); +}); + +function genPassword(pwdLen) { + var pwdChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + var rndPass = Array(pwdLen).fill(pwdChars).map(function(x) { return x[Math.floor(Math.random() * x.length)] }).join(''); + return rndPass; +} + function setupBtns() { $('#btnSummaryRefresh').click(function(){getAllInterfaces();}); $('.intsave').click(function(){