]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/account.ts
Feature/Add replay privacy (#5692)
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / account.ts
index cbdcef2fd480298ab4f966f8c5bf0413138d77d4..551f67d61fb68dc8d0a506b9cdddfe275dca7ef9 100644 (file)
@@ -1,16 +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 } from './utils'
-import { doesAccountNameWithHostExist, doesLocalAccountNameExist } from '../../helpers/middlewares'
+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
 
@@ -19,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