diff options
author | Chocobozzz <me@florianbigard.com> | 2023-01-20 15:34:01 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-01-20 15:34:01 +0100 |
commit | 4115f20084f302f497be9cb12237564679ca54ec (patch) | |
tree | 74cf8f5b3884edeb0b47b529cf04b306cd12b23d /server/middlewares | |
parent | e854d57bed56bcbba4d191af54125ae6dd569a88 (diff) | |
download | PeerTube-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.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 |