Customize route for first signin for tracking

This commit is contained in:
Tom Moor
2018-12-08 08:57:34 -08:00
parent d3911b9e20
commit b068ba9f02
3 changed files with 6 additions and 6 deletions

View File

@ -93,7 +93,7 @@ export default function auth(options?: { required?: boolean } = {}) {
ctx.cache[user.id] = user;
}
ctx.signIn = (user, team, service) => {
ctx.signIn = (user, team, service, isFirstSignin = false) => {
// update the database when the user last signed in
user.updateSignedIn(ctx.request.ip);
@ -138,7 +138,7 @@ export default function auth(options?: { required?: boolean } = {}) {
httpOnly: false,
expires,
});
ctx.redirect(`${team.url}/dashboard`);
ctx.redirect(`${team.url}/dashboard${isFirstSignin ? '?welcome' : ''}`);
}
};