diff options
Diffstat (limited to 'src/api/util/utility/passwordStrength.ts')
-rw-r--r-- | src/api/util/utility/passwordStrength.ts | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/api/util/utility/passwordStrength.ts b/src/api/util/utility/passwordStrength.ts index fd627fbf..2f3e8bb1 100644 --- a/src/api/util/utility/passwordStrength.ts +++ b/src/api/util/utility/passwordStrength.ts @@ -36,8 +36,7 @@ const reSYMBOLS = /[A-Z,a-z,0-9]/g; * Returns: 0 > pw > 1 */ export function checkPassword(password: string): number { - const { minLength, minNumbers, minUpperCase, minSymbols } = - Config.get().register.password; + const { minLength, minNumbers, minUpperCase, minSymbols } = Config.get().register.password; let strength = 0; // checks for total password len @@ -61,10 +60,7 @@ export function checkPassword(password: string): number { } // checks if password only consists of numbers or only consists of chars - if ( - password.length == password.count(reNUMBER) || - password.length === password.count(reUPPERCASELETTER) - ) { + if (password.length == password.count(reNUMBER) || password.length === password.count(reUPPERCASELETTER)) { strength = 0; } @@ -77,8 +73,6 @@ export function checkPassword(password: string): number { const entropies = Object.values(entropyMap); entropies.map((x) => x / entropyMap.length); - strength += - entropies.reduceRight((a: number, x: number) => a - x * Math.log2(x)) / - Math.log2(password.length); + strength += entropies.reduceRight((a: number, x: number) => a - x * Math.log2(x)) / Math.log2(password.length); return strength; } |