X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Faccount.ts;h=551f67d61fb68dc8d0a506b9cdddfe275dca7ef9;hb=05a60d85997c108d39bcfb14f1ffd4c74f8b1e93;hp=599eb10bb287cb4db53c29c9c547b87dd3a8dadd;hpb=10363c74c1d869f0e0c7bc4d0367b1f34d1bb6a4;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/account.ts b/server/middlewares/validators/account.ts index 599eb10bb..551f67d61 100644 --- a/server/middlewares/validators/account.ts +++ b/server/middlewares/validators/account.ts @@ -1,15 +1,13 @@ -import * as express from 'express' +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