From 6c01069f6798341ab51ef005c82057e86a6a814e Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 27 Feb 2020 17:20:29 +0000 Subject: [PATCH 1/2] Adds auto-generate secure PSK button to input --- templates/hostapd.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/templates/hostapd.php b/templates/hostapd.php index 79e2f106..8e8bdeee 100755 --- a/templates/hostapd.php +++ b/templates/hostapd.php @@ -91,9 +91,12 @@ -
- + +
+
+ +
From f63c4688bcd0e2fba8ff2128bda0763d2aef4386 Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 27 Feb 2020 17:21:57 +0000 Subject: [PATCH 2/2] 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(){