diff options
author | Chocobozzz <me@florianbigard.com> | 2018-12-18 17:18:25 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-12-18 17:18:25 +0100 |
commit | 1a12adcd1e938a405e5caeaaaf5711f197cc6cf4 (patch) | |
tree | f7ead45010deb03f0416ecafde5bc40282ad02d3 /server/middlewares | |
parent | afa4374ab4084ca95e33141d55a6449304caa665 (diff) | |
download | PeerTube-1a12adcd1e938a405e5caeaaaf5711f197cc6cf4.tar.gz PeerTube-1a12adcd1e938a405e5caeaaaf5711f197cc6cf4.tar.zst PeerTube-1a12adcd1e938a405e5caeaaaf5711f197cc6cf4.zip |
Fix users update me param validation
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/users.ts | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index ccaf2eeb6..1bb0bfb1b 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts | |||
@@ -5,15 +5,16 @@ import { body, param } from 'express-validator/check' | |||
5 | import { omit } from 'lodash' | 5 | import { omit } from 'lodash' |
6 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' | 6 | import { isIdOrUUIDValid } from '../../helpers/custom-validators/misc' |
7 | import { | 7 | import { |
8 | isUserAutoPlayVideoValid, isUserBlockedReasonValid, | 8 | isUserAutoPlayVideoValid, |
9 | isUserBlockedReasonValid, | ||
9 | isUserDescriptionValid, | 10 | isUserDescriptionValid, |
10 | isUserDisplayNameValid, | 11 | isUserDisplayNameValid, |
11 | isUserNSFWPolicyValid, | 12 | isUserNSFWPolicyValid, |
12 | isUserPasswordValid, | 13 | isUserPasswordValid, |
13 | isUserRoleValid, | 14 | isUserRoleValid, |
14 | isUserUsernameValid, | 15 | isUserUsernameValid, |
15 | isUserVideoQuotaValid, | 16 | isUserVideoQuotaDailyValid, |
16 | isUserVideoQuotaDailyValid | 17 | isUserVideoQuotaValid, isUserVideosHistoryEnabledValid |
17 | } from '../../helpers/custom-validators/users' | 18 | } from '../../helpers/custom-validators/users' |
18 | import { isVideoExist } from '../../helpers/custom-validators/videos' | 19 | import { isVideoExist } from '../../helpers/custom-validators/videos' |
19 | import { logger } from '../../helpers/logger' | 20 | import { logger } from '../../helpers/logger' |
@@ -22,7 +23,6 @@ import { Redis } from '../../lib/redis' | |||
22 | import { UserModel } from '../../models/account/user' | 23 | import { UserModel } from '../../models/account/user' |
23 | import { areValidationErrors } from './utils' | 24 | import { areValidationErrors } from './utils' |
24 | import { ActorModel } from '../../models/activitypub/actor' | 25 | import { ActorModel } from '../../models/activitypub/actor' |
25 | import { comparePassword } from '../../helpers/peertube-crypto' | ||
26 | 26 | ||
27 | const usersAddValidator = [ | 27 | const usersAddValidator = [ |
28 | body('username').custom(isUserUsernameValid).withMessage('Should have a valid username (lowercase alphanumeric characters)'), | 28 | body('username').custom(isUserUsernameValid).withMessage('Should have a valid username (lowercase alphanumeric characters)'), |
@@ -144,6 +144,9 @@ const usersUpdateMeValidator = [ | |||
144 | body('email').optional().isEmail().withMessage('Should have a valid email attribute'), | 144 | body('email').optional().isEmail().withMessage('Should have a valid email attribute'), |
145 | body('nsfwPolicy').optional().custom(isUserNSFWPolicyValid).withMessage('Should have a valid display Not Safe For Work policy'), | 145 | body('nsfwPolicy').optional().custom(isUserNSFWPolicyValid).withMessage('Should have a valid display Not Safe For Work policy'), |
146 | body('autoPlayVideo').optional().custom(isUserAutoPlayVideoValid).withMessage('Should have a valid automatically plays video attribute'), | 146 | body('autoPlayVideo').optional().custom(isUserAutoPlayVideoValid).withMessage('Should have a valid automatically plays video attribute'), |
147 | body('videosHistoryEnabled') | ||
148 | .optional() | ||
149 | .custom(isUserVideosHistoryEnabledValid).withMessage('Should have a valid videos history enabled attribute'), | ||
147 | 150 | ||
148 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 151 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
149 | logger.debug('Checking usersUpdateMe parameters', { parameters: omit(req.body, 'password') }) | 152 | logger.debug('Checking usersUpdateMe parameters', { parameters: omit(req.body, 'password') }) |