aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-25 09:57:16 +0200
committerChocobozzz <me@florianbigard.com>2018-05-25 10:41:07 +0200
commitad9e39fb815d85e5e718c40540fa75471474fa17 (patch)
tree960accb16bca0fac7694b3f3d5d038534b66c224 /server/helpers
parent06be7ed0b27b371465c5d1b7f92b4adfb0b866ea (diff)
downloadPeerTube-ad9e39fb815d85e5e718c40540fa75471474fa17.tar.gz
PeerTube-ad9e39fb815d85e5e718c40540fa75471474fa17.tar.zst
PeerTube-ad9e39fb815d85e5e718c40540fa75471474fa17.zip
Only use account name in routes
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/custom-validators/accounts.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/server/helpers/custom-validators/accounts.ts b/server/helpers/custom-validators/accounts.ts
index 00dea9039..0607d661c 100644
--- a/server/helpers/custom-validators/accounts.ts
+++ b/server/helpers/custom-validators/accounts.ts
@@ -5,6 +5,7 @@ import * as validator from 'validator'
5import { AccountModel } from '../../models/account/account' 5import { AccountModel } from '../../models/account/account'
6import { isUserDescriptionValid, isUserUsernameValid } from './users' 6import { isUserDescriptionValid, isUserUsernameValid } from './users'
7import { exists } from './misc' 7import { exists } from './misc'
8import { CONFIG } from '../../initializers'
8 9
9function isAccountNameValid (value: string) { 10function isAccountNameValid (value: string) {
10 return isUserUsernameValid(value) 11 return isUserUsernameValid(value)
@@ -40,7 +41,7 @@ function isAccountNameWithHostExist (nameWithDomain: string, res: Response, send
40 const [ accountName, host ] = nameWithDomain.split('@') 41 const [ accountName, host ] = nameWithDomain.split('@')
41 42
42 let promise: Bluebird<AccountModel> 43 let promise: Bluebird<AccountModel>
43 if (!host) promise = AccountModel.loadLocalByName(accountName) 44 if (!host || host === CONFIG.WEBSERVER.HOST) promise = AccountModel.loadLocalByName(accountName)
44 else promise = AccountModel.loadLocalByNameAndHost(accountName, host) 45 else promise = AccountModel.loadLocalByNameAndHost(accountName, host)
45 46
46 return isAccountExist(promise, res, sendNotFound) 47 return isAccountExist(promise, res, sendNotFound)