diff options
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/validators/user-registrations.ts | 7 |
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 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { body, param, query, ValidationChain } from 'express-validator' | 2 | import { body, param, query, ValidationChain } from 'express-validator' |
3 | import { exists, isIdValid } from '@server/helpers/custom-validators/misc' | 3 | import { exists, isBooleanValid, isIdValid, toBooleanOrNull } from '@server/helpers/custom-validators/misc' |
4 | import { isRegistrationModerationResponseValid, isRegistrationReasonValid } from '@server/helpers/custom-validators/user-registration' | 4 | import { isRegistrationModerationResponseValid, isRegistrationReasonValid } from '@server/helpers/custom-validators/user-registration' |
5 | import { CONFIG } from '@server/initializers/config' | 5 | import { CONFIG } from '@server/initializers/config' |
6 | import { Hooks } from '@server/lib/plugins/hooks' | 6 | import { 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 |