made it prettier
This commit is contained in:
parent
41f14b3ad8
commit
e774a9256b
@ -225,15 +225,20 @@ router.post(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (body.password) {
|
if (body.password) {
|
||||||
const min = register.password.minLength ? register.password.minLength : 8;
|
const min = register.password.minLength
|
||||||
if(body.password.length < min){
|
? register.password.minLength
|
||||||
throw FieldErrors({
|
: 8;
|
||||||
password: {
|
if (body.password.length < min) {
|
||||||
code: "PASSWORD_REQUIREMENTS_MIN_LENGTH",
|
throw FieldErrors({
|
||||||
message: req.t("auth:register.PASSWORD_REQUIREMENTS_MIN_LENGTH", { min: min })
|
password: {
|
||||||
}
|
code: "PASSWORD_REQUIREMENTS_MIN_LENGTH",
|
||||||
});
|
message: req.t(
|
||||||
}
|
"auth:register.PASSWORD_REQUIREMENTS_MIN_LENGTH",
|
||||||
|
{ min: min },
|
||||||
|
),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
// the salt is saved in the password refer to bcrypt docs
|
// the salt is saved in the password refer to bcrypt docs
|
||||||
body.password = await bcrypt.hash(body.password, 12);
|
body.password = await bcrypt.hash(body.password, 12);
|
||||||
} else if (register.password.required) {
|
} else if (register.password.required) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user