Add check for the author username length
authorChocobozzz <florian.bigard@gmail.com>
Mon, 16 May 2016 17:51:07 +0000 (19:51 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Mon, 16 May 2016 17:51:07 +0000 (19:51 +0200)
server/helpers/customValidators.js
server/initializers/constants.js

index 9b982369ee9129dc4d4014f8eacd471fc2231fe0..b95e2b9bb57a21ac036397615d0b0739ef7f3526 100644 (file)
@@ -19,6 +19,7 @@ function eachIsRemoteVideosAddValid (values) {
       !isNaN(val.duration) &&
       val.duration >= 0 &&
       val.duration < constants.MAXIMUM_VIDEO_DURATION &&
+      validator.isLength(val.author, 1, constants.MAXIMUM_AUTHOR_LENGTH) &&
       validator.isDate(val.createdDate)
   })
 }
index d87a376d321691ee4703fcfa678c47f94b6bba6e..78bee5efece2f0793e647c6f3d1f9a184860ab6e 100644 (file)
@@ -9,6 +9,8 @@ let FRIEND_BASE_SCORE = 100
 // Time to wait between requests to the friends
 let INTERVAL = 60000
 
+// Max length of the author username
+const MAXIMUM_AUTHOR_LENGTH = 20
 // 2 hours maximum for the duration of a video (in seconds)
 let MAXIMUM_VIDEO_DURATION = 7200
 
@@ -44,6 +46,7 @@ module.exports = {
   API_VERSION: API_VERSION,
   FRIEND_BASE_SCORE: FRIEND_BASE_SCORE,
   INTERVAL: INTERVAL,
+  MAXIMUM_AUTHOR_LENGTH: MAXIMUM_AUTHOR_LENGTH,
   MAXIMUM_VIDEO_DURATION: MAXIMUM_VIDEO_DURATION,
   PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT,
   PODS_SCORE: PODS_SCORE,