coyotte508 HF staff coyotte508 nsarrazin HF staff commited on
Commit
506e596
•
1 Parent(s): 5f64024

🚸 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 <coyotte508@protonmail.com>
Co-authored-by: Nathan Sarrazin <sarrazin.nathan@gmail.com>

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 },