mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-22 12:12:32 +00:00
Implemented password length check
This commit is contained in:
1 parent
6c603afc54
commit
f006ddc735
2 files changed
+10
-1
No files matched your search
@@ -225,6 +225,14 @@ router.post(
|
||||
}
|
||||
|
||||
if (body.password) {
|
||||
if(body.password.length<8){
|
||||
throw FieldErrors({
|
||||
password: {
|
||||
code: "PASSWORD_REQUIREMENTS_MIN_LENGTH",
|
||||
message: req.t("auth:register.PASSWORD_REQUIREMENTS_MIN_LENGTH")
|
||||
}
|
||||
});
|
||||
}
|
||||
// the salt is saved in the password refer to bcrypt docs
|
||||
body.password = await bcrypt.hash(body.password, 12);
|
||||
} else if (register.password.required) {
|
||||
|
||||
Reference in new issue
Block a user