X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Faccount.ts;h=551f67d61fb68dc8d0a506b9cdddfe275dca7ef9;hb=c0b5a5eb4be94038ce4d44e03cd14e2f5a844868;hp=e529c831d541ea575e80209a8d6f3d623848dc00;hpb=41fb13c330de629df2d23379209e79c7af0f2e9a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/account.ts b/server/middlewares/validators/account.ts index e529c831d..551f67d61 100644 --- a/server/middlewares/validators/account.ts +++ b/server/middlewares/validators/account.ts @@ -1,15 +1,13 @@ import express from 'express' import { param } from 'express-validator' import { isAccountNameValid } from '../../helpers/custom-validators/accounts' -import { logger } from '../../helpers/logger' import { areValidationErrors, doesAccountNameWithHostExist, doesLocalAccountNameExist } from './shared' const localAccountValidator = [ - param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'), + param('name') + .custom(isAccountNameValid), async (req: express.Request, res: express.Response, next: express.NextFunction) => { - logger.debug('Checking localAccountValidator parameters', { parameters: req.params }) - if (areValidationErrors(req, res)) return if (!await doesLocalAccountNameExist(req.params.name, res)) return @@ -18,11 +16,10 @@ const localAccountValidator = [ ] const accountNameWithHostGetValidator = [ - param('accountName').exists().withMessage('Should have an account name with host'), + param('accountName') + .exists(), async (req: express.Request, res: express.Response, next: express.NextFunction) => { - logger.debug('Checking accountsNameWithHostGetValidator parameters', { parameters: req.params }) - if (areValidationErrors(req, res)) return if (!await doesAccountNameWithHostExist(req.params.accountName, res)) return