X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fusers.ts;h=247b704c4331d8ff27c397220ec41de20d90303f;hb=fd4484f19eae8b0a0c30d5d30e98880c8708516a;hp=49bc0bb560edb85f5c740b6fe69d8e8b3752c397;hpb=2422c46b27790d94fd29a7092170cee5a1b56008;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index 49bc0bb56..247b704c4 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts @@ -7,8 +7,8 @@ import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' import { isAvatarFile, isUserAutoPlayVideoValid, - isUserDescriptionValid, - isUserDisplayNSFWValid, + isUserDescriptionValid, isUserDisplayNameValid, + isUserNSFWPolicyValid, isUserPasswordValid, isUserRoleValid, isUserUsernameValid, @@ -98,10 +98,11 @@ const usersUpdateValidator = [ ] const usersUpdateMeValidator = [ + body('displayName').optional().custom(isUserDisplayNameValid).withMessage('Should have a valid display name'), body('description').optional().custom(isUserDescriptionValid).withMessage('Should have a valid description'), body('password').optional().custom(isUserPasswordValid).withMessage('Should have a valid password'), body('email').optional().isEmail().withMessage('Should have a valid email attribute'), - body('displayNSFW').optional().custom(isUserDisplayNSFWValid).withMessage('Should have a valid display Not Safe For Work attribute'), + body('nsfwPolicy').optional().custom(isUserNSFWPolicyValid).withMessage('Should have a valid display Not Safe For Work policy'), body('autoPlayVideo').optional().custom(isUserAutoPlayVideoValid).withMessage('Should have a valid automatically plays video attribute'), (req: express.Request, res: express.Response, next: express.NextFunction) => { @@ -250,7 +251,7 @@ async function checkUserNameOrEmailDoesNotAlreadyExist (username: string, email: if (user) { res.status(409) - .send({ error: 'User with this username of email already exists.' }) + .send({ error: 'User with this username or email already exists.' }) .end() return false }