compare with adminFqdn instead of adminLocation

This commit is contained in:
Girish Ramakrishnan
2018-01-10 18:14:29 -08:00
parent 969fba83ea
commit 3067e0940d

View File

@@ -127,7 +127,6 @@ function validateHostname(location, domain, hostname) {
assert.strictEqual(typeof domain, 'string');
const RESERVED_LOCATIONS = [
config.adminLocation(), // FIXME: this shouldn't be here
constants.API_LOCATION,
constants.SMTP_LOCATION,
constants.IMAP_LOCATION,
@@ -135,6 +134,8 @@ function validateHostname(location, domain, hostname) {
];
if (RESERVED_LOCATIONS.indexOf(location) !== -1) return new AppsError(AppsError.BAD_FIELD, location + ' is reserved');
if (hostname === config.adminFqdn()) return new AppsError(AppsError.BAD_FIELD, location + ' is reserved');
// workaround https://github.com/oncletom/tld.js/issues/73
var tmp = hostname.replace('_', '-');
if (!tld.isValid(tmp)) return new AppsError(AppsError.BAD_FIELD, 'Hostname is not a valid domain name');