fix: Update email in auth service should update email in Outline
This commit is contained in:
@@ -91,6 +91,11 @@ router.get('google.callback', auth({ required: false }), async ctx => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// update email address if it's changed in Google
|
||||||
|
if (!isFirstSignin && profile.data.email !== user.email) {
|
||||||
|
await user.update({ email: profile.data.email });
|
||||||
|
}
|
||||||
|
|
||||||
if (isFirstUser) {
|
if (isFirstUser) {
|
||||||
await team.provisionFirstCollection(user.id);
|
await team.provisionFirstCollection(user.id);
|
||||||
await team.provisionSubdomain(hostname);
|
await team.provisionSubdomain(hostname);
|
||||||
|
|||||||
@@ -69,6 +69,11 @@ router.get('slack.callback', auth({ required: false }), async ctx => {
|
|||||||
await team.provisionSubdomain(data.team.domain);
|
await team.provisionSubdomain(data.team.domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update email address if it's changed in Slack
|
||||||
|
if (!isFirstSignin && data.user.email !== user.email) {
|
||||||
|
await user.update({ email: data.user.email });
|
||||||
|
}
|
||||||
|
|
||||||
// set cookies on response and redirect to team subdomain
|
// set cookies on response and redirect to team subdomain
|
||||||
ctx.signIn(user, team, 'slack', isFirstSignin);
|
ctx.signIn(user, team, 'slack', isFirstSignin);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user