eea1f4fc17e4

apply same site-max default and policy-clamped commitLenEdit to inline popup generator

time
2026-05-15 01:27 UTC · 5 months ago
machine
koh2
parent
cf4fa3ba4eac
1 file src/content/inject.ts+3 −3
src/content/inject.ts+3 −3
@@ -210,9 +210,9 @@210210 function createSmartGenerator(opts: SmartGeneratorOptions): SmartGenerator {211211   const policy = opts.policy ?? {};212212 213-  let length = 64;213+  // Start at site max (strongest password the site accepts), fall back to 64214+  let length = policy.maxLength ?? 64;214215   if (policy.minLength) length = Math.max(length, policy.minLength);215-  if (policy.maxLength) length = Math.min(length, policy.maxLength);216216   if (length < 8) length = 8;217217   if (length > 128) length = 128;218218 @@ -274,7 +274,7 @@274274     function commitLenEdit() {275275       const n = parseInt(li.value, 10);276276       if (!isNaN(n)) {277-        length = Math.max(8, Math.min(128, n));277+        length = Math.max(parseInt(slider.min, 10), Math.min(parseInt(slider.max, 10), n));278278         slider.value = String(length);279279         regenerate();280280       }

view file