]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/users.ts
Cache AP video route for 5 seconds
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / users.ts
index 49bc0bb560edb85f5c740b6fe69d8e8b3752c397..247b704c4331d8ff27c397220ec41de20d90303f 100644 (file)
@@ -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
   }