aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/validators/user-registrations.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/server/middlewares/validators/user-registrations.ts b/server/middlewares/validators/user-registrations.ts
index e263c27c5..fcf655a2c 100644
--- a/server/middlewares/validators/user-registrations.ts
+++ b/server/middlewares/validators/user-registrations.ts
@@ -1,6 +1,6 @@
1import express from 'express' 1import express from 'express'
2import { body, param, query, ValidationChain } from 'express-validator' 2import { body, param, query, ValidationChain } from 'express-validator'
3import { exists, isIdValid } from '@server/helpers/custom-validators/misc' 3import { exists, isBooleanValid, isIdValid, toBooleanOrNull } from '@server/helpers/custom-validators/misc'
4import { isRegistrationModerationResponseValid, isRegistrationReasonValid } from '@server/helpers/custom-validators/user-registration' 4import { isRegistrationModerationResponseValid, isRegistrationReasonValid } from '@server/helpers/custom-validators/user-registration'
5import { CONFIG } from '@server/initializers/config' 5import { CONFIG } from '@server/initializers/config'
6import { Hooks } from '@server/lib/plugins/hooks' 6import { Hooks } from '@server/lib/plugins/hooks'
@@ -91,6 +91,11 @@ const acceptOrRejectRegistrationValidator = [
91 body('moderationResponse') 91 body('moderationResponse')
92 .custom(isRegistrationModerationResponseValid), 92 .custom(isRegistrationModerationResponseValid),
93 93
94 body('preventEmailDelivery')
95 .optional()
96 .customSanitizer(toBooleanOrNull)
97 .custom(isBooleanValid).withMessage('Should have preventEmailDelivery boolean'),
98
94 async (req: express.Request, res: express.Response, next: express.NextFunction) => { 99 async (req: express.Request, res: express.Response, next: express.NextFunction) => {
95 if (areValidationErrors(req, res)) return 100 if (areValidationErrors(req, res)) return
96 if (!await checkRegistrationIdExist(req.params.registrationId, res)) return 101 if (!await checkRegistrationIdExist(req.params.registrationId, res)) return