Allow subdomain in the location field

This allows one to easily add "dev.staging@domain.com" etc without having to create
yet another domain. This plays well with the concept that we have a
mail domain for every domain. So we get mails from @domain.com working for
these subdomain installations.
This commit is contained in:
Girish Ramakrishnan
2018-08-04 09:23:30 -07:00
parent 95540e8cbc
commit a8ba0b91f7
3 changed files with 11 additions and 6 deletions

View File

@@ -182,16 +182,18 @@ describe('Apps', function () {
});
it('cannot have >63 length subdomains', function () {
var s = '';
for (var i = 0; i < 64; i++) s += 's';
var s = Array(64).fill('s').join('');
expect(apps._validateHostname(s, 'example.com', s + '.example.com')).to.be.an(Error);
expect(apps._validateHostname(`dev.${s}`, 'example.com', `dev.${s}.example.com`)).to.be.an(Error);
});
it('allows only alphanumerics and hypen', function () {
expect(apps._validateHostname('#2r', 'example.com', '#2r.example.com')).to.be.an(Error);
expect(apps._validateHostname('a%b', 'example.com', 'a%b.example.com')).to.be.an(Error);
expect(apps._validateHostname('ab_', 'example.com', 'ab_.example.com')).to.be.an(Error);
expect(apps._validateHostname('a.b', 'example.com', 'a.b.example.com')).to.be.an(Error);
expect(apps._validateHostname('ab.', 'example.com', 'ab.example.com')).to.be.an(Error);
expect(apps._validateHostname('ab..c', 'example.com', 'ab..c.example.com')).to.be.an(Error);
expect(apps._validateHostname('.ab', 'example.com', '.ab.example.com')).to.be.an(Error);
expect(apps._validateHostname('-ab', 'example.com', '-ab.example.com')).to.be.an(Error);
expect(apps._validateHostname('ab-', 'example.com', 'ab-.example.com')).to.be.an(Error);
});
@@ -206,6 +208,8 @@ describe('Apps', function () {
it('allow valid domains', function () {
expect(apps._validateHostname('a', 'example.com', 'a.example.com')).to.be(null);
expect(apps._validateHostname('a0-x', 'example.com', 'a0-x.example.com')).to.be(null);
expect(apps._validateHostname('a0.x', 'example.com', 'a0-x.example.com')).to.be(null);
expect(apps._validateHostname('a0.x.y', 'example.com', 'a0.x.y.example.com')).to.be(null);
expect(apps._validateHostname('01', 'example.com', '01.example.com')).to.be(null);
});
});