summary refs log tree commit diff
path: root/src/api/util
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-10-03 20:50:48 +0200
committerRory& <root@rory.gay>2025-10-04 19:09:26 +0200
commita25393e80683dbb1d2b9e305af624aa3752050d6 (patch)
treed9ab5fa79a8e89d49fb70587ac6772ec7fe99cc8 /src/api/util
parentAdd Array.remove extension (diff)
downloadserver-ts-a25393e80683dbb1d2b9e305af624aa3752050d6.tar.xz
Clean up array extensions
Diffstat (limited to 'src/api/util')
-rw-r--r--src/api/util/utility/passwordStrength.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/api/util/utility/passwordStrength.ts b/src/api/util/utility/passwordStrength.ts

index fcd42d8d..f48b8022 100644 --- a/src/api/util/utility/passwordStrength.ts +++ b/src/api/util/utility/passwordStrength.ts
@@ -20,7 +20,7 @@ import { Config } from "@spacebar/util"; const reNUMBER = /[0-9]/g; const reUPPERCASELETTER = /[A-Z]/g; -const reSYMBOLS = /[A-Z,a-z,0-9]/g; +const reSYMBOLS = /[A-Za-z0-9]/g; // const blocklist: string[] = []; // TODO: update ones passwordblocklist is stored in db /* @@ -45,12 +45,12 @@ export function checkPassword(password: string): number { } // checks for amount of Numbers - if (password.count(reNUMBER) >= minNumbers - 1) { + if (password.match(reNUMBER)?.length ?? 0 >= minNumbers - 1) { strength += 0.05; } // checks for amount of Uppercase Letters - if (password.count(reUPPERCASELETTER) >= minUpperCase - 1) { + if (password.match(reUPPERCASELETTER)?.length ?? 0 >= minUpperCase - 1) { strength += 0.05; } @@ -61,8 +61,8 @@ 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) + password.length == password.match(reNUMBER)?.length || + password.length === password.match(reUPPERCASELETTER)?.length ) { strength = 0; }