Provision subdomain for ALL new teams, add tests

This commit is contained in:
Tom Moor
2018-11-12 14:00:23 -08:00
parent b3a8d34af3
commit c60bd4260f
5 changed files with 40 additions and 17 deletions

View File

@ -92,14 +92,8 @@ router.get('google.callback', auth({ required: false }), async ctx => {
});
if (isFirstUser) {
await team.createFirstCollection(user.id);
// attempt to give the new team a subdomain based on google hosted domain
try {
await team.update({ subdomain: hostname });
} catch (err) {
// subdomain was invalid or already used
}
await team.provisionFirstCollection(user.id);
await team.provisionSubdomain(hostname);
}
// set cookies on response and redirect to team subdomain