X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fvalidators%2Fserver.ts;h=d040e8a1f286b628268d3db9cb1c6331c2bea9d8;hb=4cf800a350972a078c074da6b31da2b98ab4b007;hp=fc7239b25203fb411a70a25597f1e0c2f4a32e50;hpb=cf21b2cbef61929177b9c09b5e017c3b7eb8535d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/validators/server.ts b/server/middlewares/validators/server.ts index fc7239b25..d040e8a1f 100644 --- a/server/middlewares/validators/server.ts +++ b/server/middlewares/validators/server.ts @@ -1,6 +1,6 @@ -import * as express from 'express' +import express from 'express' import { body } from 'express-validator' -import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' +import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' import { isHostValid, isValidContactBody } from '../../helpers/custom-validators/servers' import { isUserDisplayNameValid } from '../../helpers/custom-validators/users' import { logger } from '../../helpers/logger' @@ -13,8 +13,6 @@ const serverGetValidator = [ body('host').custom(isHostValid).withMessage('Should have a valid host'), async (req: express.Request, res: express.Response, next: express.NextFunction) => { - logger.debug('Checking serverGetValidator parameters', { parameters: req.body }) - if (areValidationErrors(req, res)) return const server = await ServerModel.loadByHost(req.body.host) @@ -33,15 +31,13 @@ const serverGetValidator = [ const contactAdministratorValidator = [ body('fromName') - .custom(isUserDisplayNameValid).withMessage('Should have a valid name'), + .custom(isUserDisplayNameValid), body('fromEmail') - .isEmail().withMessage('Should have a valid email'), + .isEmail(), body('body') - .custom(isValidContactBody).withMessage('Should have a valid body'), + .custom(isValidContactBody), async (req: express.Request, res: express.Response, next: express.NextFunction) => { - logger.debug('Checking contactAdministratorValidator parameters', { parameters: req.body }) - if (areValidationErrors(req, res)) return if (CONFIG.CONTACT_FORM.ENABLED === false) {