aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/account.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/account.ts')
-rw-r--r--server/middlewares/validators/account.ts10
1 files changed, 4 insertions, 6 deletions
diff --git a/server/middlewares/validators/account.ts b/server/middlewares/validators/account.ts
index 3ccf2ea21..58eeed3cc 100644
--- a/server/middlewares/validators/account.ts
+++ b/server/middlewares/validators/account.ts
@@ -8,13 +8,13 @@ import {
8 isUserVideoQuotaValid, 8 isUserVideoQuotaValid,
9 logger 9 logger
10} from '../../helpers' 10} from '../../helpers'
11import { isAccountNameWithHostValid } from '../../helpers/custom-validators/video-accounts' 11import { isAccountNameValid } from '../../helpers/custom-validators/accounts'
12import { database as db } from '../../initializers/database' 12import { database as db } from '../../initializers/database'
13import { AccountInstance } from '../../models' 13import { AccountInstance } from '../../models'
14import { checkErrors } from './utils' 14import { checkErrors } from './utils'
15 15
16const localAccountValidator = [ 16const localAccountValidator = [
17 param('nameWithHost').custom(isAccountNameWithHostValid).withMessage('Should have a valid account with domain name (myuser@domain.tld)'), 17 param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'),
18 18
19 (req: express.Request, res: express.Response, next: express.NextFunction) => { 19 (req: express.Request, res: express.Response, next: express.NextFunction) => {
20 logger.debug('Checking localAccountValidator parameters', { parameters: req.params }) 20 logger.debug('Checking localAccountValidator parameters', { parameters: req.params })
@@ -33,10 +33,8 @@ export {
33 33
34// --------------------------------------------------------------------------- 34// ---------------------------------------------------------------------------
35 35
36function checkLocalAccountExists (nameWithHost: string, res: express.Response, callback: (err: Error, account: AccountInstance) => void) { 36function checkLocalAccountExists (name: string, res: express.Response, callback: (err: Error, account: AccountInstance) => void) {
37 const [ name, host ] = nameWithHost.split('@') 37 db.Account.loadLocalByName(name)
38
39 db.Account.loadLocalAccountByNameAndPod(name, host)
40 .then(account => { 38 .then(account => {
41 if (!account) { 39 if (!account) {
42 return res.status(404) 40 return res.status(404)