From ad9e39fb815d85e5e718c40540fa75471474fa17 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 25 May 2018 09:57:16 +0200 Subject: Only use account name in routes --- server/helpers/custom-validators/accounts.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'server/helpers/custom-validators') 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' import { AccountModel } from '../../models/account/account' import { isUserDescriptionValid, isUserUsernameValid } from './users' import { exists } from './misc' +import { CONFIG } from '../../initializers' function isAccountNameValid (value: string) { return isUserUsernameValid(value) @@ -40,7 +41,7 @@ function isAccountNameWithHostExist (nameWithDomain: string, res: Response, send const [ accountName, host ] = nameWithDomain.split('@') let promise: Bluebird - if (!host) promise = AccountModel.loadLocalByName(accountName) + if (!host || host === CONFIG.WEBSERVER.HOST) promise = AccountModel.loadLocalByName(accountName) else promise = AccountModel.loadLocalByNameAndHost(accountName, host) return isAccountExist(promise, res, sendNotFound) -- cgit v1.2.3