diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-25 17:28:45 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-07-25 17:28:45 +0200 |
commit | 2b65c4e53511ccb85b17479cb1c62717afb8511c (patch) | |
tree | 1dd9ecd1803023fa66152c4746c6050e57adceaa /server/middlewares | |
parent | 552d95b1e69fbbd99f5bc300a127457e1b97b9df (diff) | |
download | PeerTube-2b65c4e53511ccb85b17479cb1c62717afb8511c.tar.gz PeerTube-2b65c4e53511ccb85b17479cb1c62717afb8511c.tar.zst PeerTube-2b65c4e53511ccb85b17479cb1c62717afb8511c.zip |
Fix scheduled privacy and verify email validations
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/users.ts | 4 | ||||
-rw-r--r-- | server/middlewares/validators/videos/videos.ts | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index db03dc231..da92c715d 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts | |||
@@ -2,7 +2,7 @@ import * as Bluebird from 'bluebird' | |||
2 | import * as express from 'express' | 2 | import * as express from 'express' |
3 | import { body, param } from 'express-validator' | 3 | import { body, param } from 'express-validator' |
4 | import { omit } from 'lodash' | 4 | import { omit } from 'lodash' |
5 | import { isIdOrUUIDValid, toIntOrNull } from '../../helpers/custom-validators/misc' | 5 | import { isIdOrUUIDValid, toBooleanOrNull, toIntOrNull } from '../../helpers/custom-validators/misc' |
6 | import { | 6 | import { |
7 | isUserAdminFlagsValid, | 7 | isUserAdminFlagsValid, |
8 | isUserAutoPlayVideoValid, | 8 | isUserAutoPlayVideoValid, |
@@ -357,7 +357,7 @@ const usersVerifyEmailValidator = [ | |||
357 | .not().isEmpty().withMessage('Should have a valid verification string'), | 357 | .not().isEmpty().withMessage('Should have a valid verification string'), |
358 | body('isPendingEmail') | 358 | body('isPendingEmail') |
359 | .optional() | 359 | .optional() |
360 | .customSanitizer(toIntOrNull), | 360 | .customSanitizer(toBooleanOrNull), |
361 | 361 | ||
362 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { | 362 | async (req: express.Request, res: express.Response, next: express.NextFunction) => { |
363 | logger.debug('Checking usersVerifyEmail parameters', { parameters: req.params }) | 363 | logger.debug('Checking usersVerifyEmail parameters', { parameters: req.params }) |
diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts index 27dfe91ca..af06f3c62 100644 --- a/server/middlewares/validators/videos/videos.ts +++ b/server/middlewares/validators/videos/videos.ts | |||
@@ -349,7 +349,7 @@ function getCommonVideoEditAttributes () { | |||
349 | .custom(isDateValid).withMessage('Should have a valid schedule update date'), | 349 | .custom(isDateValid).withMessage('Should have a valid schedule update date'), |
350 | body('scheduleUpdate.privacy') | 350 | body('scheduleUpdate.privacy') |
351 | .optional() | 351 | .optional() |
352 | .customSanitizer(toValueOrNull) | 352 | .customSanitizer(toIntOrNull) |
353 | .custom(isScheduleVideoUpdatePrivacyValid).withMessage('Should have correct schedule update privacy') | 353 | .custom(isScheduleVideoUpdatePrivacyValid).withMessage('Should have correct schedule update privacy') |
354 | ] as (ValidationChain | express.Handler)[] | 354 | ] as (ValidationChain | express.Handler)[] |
355 | } | 355 | } |