Prevent signin without hosted domain

This commit is contained in:
Tom Moor
2018-05-28 22:32:36 -07:00
parent 25aa1f288b
commit aa9ed09f08
6 changed files with 25 additions and 2 deletions

View File

@ -37,6 +37,11 @@ router.get('google.callback', async ctx => {
url: 'https://www.googleapis.com/oauth2/v1/userinfo',
});
if (!profile.data.hd) {
ctx.redirect('/?notice=google-hd');
return;
}
const teamName = capitalize(profile.data.hd.split('.')[0]);
const [team, isFirstUser] = await Team.findOrCreate({
where: {