X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fusers.ts;h=6c5e783e93c7560ae85fff4091a434cb1e4423bc;hb=bee0abffff73804d816b90c7fd599e0a51c09d61;hp=f47fa8b4893b81f940ed2b35475eeffa09f7d98b;hpb=06215f15e0a9fea2ef95b8b49cb2b5868fb64017;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts index f47fa8b48..6c5e783e9 100644 --- a/server/middlewares/validators/users.ts +++ b/server/middlewares/validators/users.ts @@ -12,7 +12,8 @@ import { isUserPasswordValid, isUserRoleValid, isUserUsernameValid, - isUserVideoQuotaValid + isUserVideoQuotaValid, + isUserVideoQuotaDailyValid } from '../../helpers/custom-validators/users' import { isVideoExist } from '../../helpers/custom-validators/videos' import { logger } from '../../helpers/logger' @@ -27,6 +28,7 @@ const usersAddValidator = [ body('password').custom(isUserPasswordValid).withMessage('Should have a valid password'), body('email').isEmail().withMessage('Should have a valid email'), body('videoQuota').custom(isUserVideoQuotaValid).withMessage('Should have a valid user quota'), + body('videoQuotaDaily').custom(isUserVideoQuotaDailyValid).withMessage('Should have a valid daily user quota'), body('role').custom(isUserRoleValid).withMessage('Should have a valid role'), async (req: express.Request, res: express.Response, next: express.NextFunction) => { @@ -112,6 +114,7 @@ const usersUpdateValidator = [ param('id').isInt().not().isEmpty().withMessage('Should have a valid id'), body('email').optional().isEmail().withMessage('Should have a valid email attribute'), body('videoQuota').optional().custom(isUserVideoQuotaValid).withMessage('Should have a valid user quota'), + body('videoQuotaDaily').optional().custom(isUserVideoQuotaDailyValid).withMessage('Should have a valid daily user quota'), body('role').optional().custom(isUserRoleValid).withMessage('Should have a valid role'), async (req: express.Request, res: express.Response, next: express.NextFunction) => { @@ -286,7 +289,7 @@ async function checkUserNameOrEmailDoesNotAlreadyExist (username: string, email: const actor = await ActorModel.loadLocalByName(username) if (actor) { res.status(409) - .send({ error: 'Another actor (account/channel) with this name already exists.' }) + .send({ error: 'Another actor (account/channel) with this name on this instance already exists or has already existed.' }) .end() return false }