From 350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 14 Nov 2017 17:31:26 +0100 Subject: Follow works --- server/middlewares/validators/account.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'server/middlewares/validators/account.ts') 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 { isUserVideoQuotaValid, logger } from '../../helpers' -import { isAccountNameWithHostValid } from '../../helpers/custom-validators/video-accounts' +import { isAccountNameValid } from '../../helpers/custom-validators/accounts' import { database as db } from '../../initializers/database' import { AccountInstance } from '../../models' import { checkErrors } from './utils' const localAccountValidator = [ - param('nameWithHost').custom(isAccountNameWithHostValid).withMessage('Should have a valid account with domain name (myuser@domain.tld)'), + param('name').custom(isAccountNameValid).withMessage('Should have a valid account name'), (req: express.Request, res: express.Response, next: express.NextFunction) => { logger.debug('Checking localAccountValidator parameters', { parameters: req.params }) @@ -33,10 +33,8 @@ export { // --------------------------------------------------------------------------- -function checkLocalAccountExists (nameWithHost: string, res: express.Response, callback: (err: Error, account: AccountInstance) => void) { - const [ name, host ] = nameWithHost.split('@') - - db.Account.loadLocalAccountByNameAndPod(name, host) +function checkLocalAccountExists (name: string, res: express.Response, callback: (err: Error, account: AccountInstance) => void) { + db.Account.loadLocalByName(name) .then(account => { if (!account) { return res.status(404) -- cgit v1.2.3