From 41f14b3ad8d75a8d0158f72d8fe0825c3a8ac724 Mon Sep 17 00:00:00 2001 From: ngn Date: Sun, 11 Jun 2023 13:36:51 +0300 Subject: Make sure min password length is not null --- src/api/routes/auth/register.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') 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 }) } }); } -- cgit 1.5.1