From 07fe9960d0fb643d1be8dfdc19c7e2d2f411a478 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Tue, 21 Apr 2020 16:03:52 +0300 Subject: [PATCH] refactor(core): add max length control to generatePassword fn --- npm/ng-packs/packages/core/src/lib/utils/generator-utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/core/src/lib/utils/generator-utils.ts b/npm/ng-packs/packages/core/src/lib/utils/generator-utils.ts index 9fccfb8271..a5fd4c9c65 100644 --- a/npm/ng-packs/packages/core/src/lib/utils/generator-utils.ts +++ b/npm/ng-packs/packages/core/src/lib/utils/generator-utils.ts @@ -19,7 +19,7 @@ export function generateHash(value: string): number { } export function generatePassword(length = 8) { - length = length < 4 ? 4 : length; + length = Math.min(Math.max(4, length), 128); const lowers = 'abcdefghijklmnopqrstuvwxyz'; const uppers = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';