fixed incorrect validation message being shown

This commit is contained in:
Miodec 2022-12-11 22:39:55 +01:00
parent 574ff0538c
commit 948f667b2a

View file

@ -460,12 +460,14 @@ const profileDetailsBase = joi
.string()
.allow("")
.custom((value, helpers) => {
return containsProfanity(value)
? helpers.error("string.pattern.base")
: value;
if (containsProfanity(value)) {
return helpers.error("string.profanity");
}
return value;
})
.messages({
"string.pattern.base": "Profanity detected. Please remove it.",
"string.profanity": "Profanity detected. Please remove it.",
});
router.patch(