diff options
author | Chocobozzz <me@florianbigard.com> | 2018-05-25 09:57:16 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-05-25 10:41:07 +0200 |
commit | ad9e39fb815d85e5e718c40540fa75471474fa17 (patch) | |
tree | 960accb16bca0fac7694b3f3d5d038534b66c224 /server/helpers | |
parent | 06be7ed0b27b371465c5d1b7f92b4adfb0b866ea (diff) | |
download | PeerTube-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.ts | 3 |
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' | |||
5 | import { AccountModel } from '../../models/account/account' | 5 | import { AccountModel } from '../../models/account/account' |
6 | import { isUserDescriptionValid, isUserUsernameValid } from './users' | 6 | import { isUserDescriptionValid, isUserUsernameValid } from './users' |
7 | import { exists } from './misc' | 7 | import { exists } from './misc' |
8 | import { CONFIG } from '../../initializers' | ||
8 | 9 | ||
9 | function isAccountNameValid (value: string) { | 10 | function 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) |