diff options
author | ngn <ngn13proton@proton.me> | 2023-06-11 13:36:51 +0300 |
---|---|---|
committer | ngn <ngn13proton@proton.me> | 2023-06-11 13:36:51 +0300 |
commit | 41f14b3ad8d75a8d0158f72d8fe0825c3a8ac724 (patch) | |
tree | c8dbccba767af523cbf21d4c8cb582524d2ca6a1 /src | |
parent | Merge branch 'spacebarchat:master' into pass_length_check (diff) | |
download | server-41f14b3ad8d75a8d0158f72d8fe0825c3a8ac724.tar.xz |
Make sure min password length is not null
Diffstat (limited to 'src')
-rw-r--r-- | src/api/routes/auth/register.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/api/routes/auth/register.ts b/src/api/routes/auth/register.ts index 247fa88f..46026d7d 100644 --- a/src/api/routes/auth/register.ts +++ b/src/api/routes/auth/register.ts @@ -225,11 +225,12 @@ router.post( } if (body.password) { - if(body.password.length < register.password.minLength){ + const min = register.password.minLength ? register.password.minLength : 8; + if(body.password.length < min){ throw FieldErrors({ password: { code: "PASSWORD_REQUIREMENTS_MIN_LENGTH", - message: req.t("auth:register.PASSWORD_REQUIREMENTS_MIN_LENGTH", { min: register.password.minLength }) + message: req.t("auth:register.PASSWORD_REQUIREMENTS_MIN_LENGTH", { min: min }) } }); } |