diff --git a/app.py b/app.py index 9ff10f2..19300f0 100644 --- a/app.py +++ b/app.py @@ -262,10 +262,9 @@ function setPassword() { } function genPassword() { - const chars = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789"; - const arr = new Uint32Array(10); + const arr = new Uint32Array(1); crypto.getRandomValues(arr); - const pw = Array.from(arr, n => chars[n % chars.length]).join(""); + const pw = String(arr[0] % 10000).padStart(4, "0"); $("#pw-input").value = pw; $("#pw-input").type = "text"; $("#pw-msg").textContent = "Copy this password before setting it.";