🚸 When a user signs up they're directly logged in (#952)
Browse files* 🚸 When a user signs up they're directly logged in
* lint
---------
Co-authored-by: coyotte508 <[email protected]>
Co-authored-by: Nathan Sarrazin <[email protected]>
src/routes/login/callback/updateUser.ts
CHANGED
|
@@ -92,9 +92,6 @@ export async function updateUser(params: {
|
|
| 92 |
ip,
|
| 93 |
expiresAt: addWeeks(new Date(), 2),
|
| 94 |
});
|
| 95 |
-
|
| 96 |
-
// refresh session cookie
|
| 97 |
-
refreshSessionCookie(cookies, secretSessionId);
|
| 98 |
} else {
|
| 99 |
// user doesn't exist yet, create a new one
|
| 100 |
const { insertedId } = await collections.users.insertOne({
|
|
@@ -142,6 +139,9 @@ export async function updateUser(params: {
|
|
| 142 |
}
|
| 143 |
}
|
| 144 |
|
|
|
|
|
|
|
|
|
|
| 145 |
// migrate pre-existing conversations
|
| 146 |
await collections.conversations.updateMany(
|
| 147 |
{ sessionId: previousSessionId },
|
|
|
|
| 92 |
ip,
|
| 93 |
expiresAt: addWeeks(new Date(), 2),
|
| 94 |
});
|
|
|
|
|
|
|
|
|
|
| 95 |
} else {
|
| 96 |
// user doesn't exist yet, create a new one
|
| 97 |
const { insertedId } = await collections.users.insertOne({
|
|
|
|
| 139 |
}
|
| 140 |
}
|
| 141 |
|
| 142 |
+
// refresh session cookie
|
| 143 |
+
refreshSessionCookie(cookies, secretSessionId);
|
| 144 |
+
|
| 145 |
// migrate pre-existing conversations
|
| 146 |
await collections.conversations.updateMany(
|
| 147 |
{ sessionId: previousSessionId },
|