From 1f756b1022e62499b7b4591622105f8efb19aace Mon Sep 17 00:00:00 2001 From: pradyun Date: Mon, 24 Apr 2023 11:29:42 +1200 Subject: [PATCH] Fix incorrect length of password and number gen --- CHANGELOG.md | 5 +++++ src/index.tsx | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f06bfd..d1fef37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ # Apple-Like Password Changelog +## [Bug Fix] - 2023-04-24 + +- Fix incorrect length of password +- Fix number sometimes not generating + ## [Initial Version] - 2023-04-24 \ No newline at end of file diff --git a/src/index.tsx b/src/index.tsx index 565dc44..a92b64a 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -41,7 +41,7 @@ function generate() { // pick characters let count = 1; let passwordSection = ""; - for (let i = 1; i < 18; i++) { + for (let i = 1; i <= 18; i++) { count += 1; if (NumberPosition === i) { @@ -68,7 +68,7 @@ function generate() { } // separate characters into sections - if (i % 6 === 0) { + if (i !== 18 && i % 6 === 0) { passwordSection += "-"; } }