aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-01-20 15:34:01 +0100
committerChocobozzz <me@florianbigard.com>2023-01-20 15:34:01 +0100
commit4115f20084f302f497be9cb12237564679ca54ec (patch)
tree74cf8f5b3884edeb0b47b529cf04b306cd12b23d /server/middlewares
parente854d57bed56bcbba4d191af54125ae6dd569a88 (diff)
downloadPeerTube-4115f20084f302f497be9cb12237564679ca54ec.tar.gz
PeerTube-4115f20084f302f497be9cb12237564679ca54ec.tar.zst
PeerTube-4115f20084f302f497be9cb12237564679ca54ec.zip
Add ability to not send an email for registration
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