Skip to content

Commit

Permalink
fix(handlers): Update user session assignment in handlers to fix auth…
Browse files Browse the repository at this point in the history
…entication bug
  • Loading branch information
wajeht committed Jan 6, 2025
1 parent 3ed7ce1 commit 2149836
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function getPrivacyPolicyPageHandler(_req: Request, res: Response) {
// GET /
export async function getHomePageAndSearchHandler(req: Request, res: Response) {
const query = req.query.q?.toString().trim() || '';
const user = req.user!;
const user = req.session.user!;

if (!query) {
if (!user) {
Expand Down Expand Up @@ -132,8 +132,8 @@ export async function getGithubRedirectHandler(req: Request, res: Response) {
.returning('*');
}

req.session.user = foundUser;
req.user = foundUser;
req.session.user = foundUser;

const redirectTo = req.session.redirectTo;
delete req.session.redirectTo;
Expand Down

0 comments on commit 2149836

Please sign in to comment.