summary refs log tree commit diff
diff options
context:
space:
mode:
authorngn <ngn13proton@proton.me>2023-06-11 13:36:51 +0300
committerngn <ngn13proton@proton.me>2023-06-11 13:36:51 +0300
commit41f14b3ad8d75a8d0158f72d8fe0825c3a8ac724 (patch)
treec8dbccba767af523cbf21d4c8cb582524d2ca6a1
parentMerge branch 'spacebarchat:master' into pass_length_check (diff)
downloadserver-41f14b3ad8d75a8d0158f72d8fe0825c3a8ac724.tar.xz
Make sure min password length is not null
-rw-r--r--src/api/routes/auth/register.ts5
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 })
                                         }
                                 });
                         }