NobGit
public anord read

Ledger

Why work hard when you can work easier?

Languages

Repository composition by tracked source files.

TypeScript
TypeScript 86% CSS 10% SQL 3% Shell 1% HTML 0%
Create file Wiki Documentation
Clone
https://nobgit.com/orgs/anord/ledger.git
ssh://[email protected]:2222/orgs/anord/ledger.git

Trace

apps/api/src/http/routes/auth.ts

Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.

auth.ts on main
Author Date Commit Line Code
Alex Nord 3 months ago 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
1
import { Router } from "express";
Open commit View diff
1 import { Router } from "express";
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
2
import { z } from "zod";
Open commit View diff
2 import { z } from "zod";
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
3
import { createSessionToken, getUserForSession, hashPassword, verifyPassword } from "../../services/auth.js";
Open commit View diff
3 import { createSessionToken, getUserForSession, hashPassword, verifyPassword } from "../../services/auth.js";
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
4
import { pool } from "../../db/pool.js";
Open commit View diff
4 import { pool } from "../../db/pool.js";
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
5
import { env, isProduction } from "../../config/env.js";
Open commit View diff
5 import { env, isProduction } from "../../config/env.js";
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
6
import { logAudit } from "../../services/audit.js";
Open commit View diff
6 import { logAudit } from "../../services/audit.js";
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
7
Open commit View diff
7
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
8
const loginSchema = z.object({
Open commit View diff
8 const loginSchema = z.object({
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
9
  email: z.string().email(),
Open commit View diff
9 email: z.string().email(),
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
10
  password: z.string().min(8)
Open commit View diff
10 password: z.string().min(8)
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
11
});
Open commit View diff
11 });
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
12
Open commit View diff
12
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
13
const registerSchema = z.object({
Open commit View diff
13 const registerSchema = z.object({
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
14
  email: z.string().email(),
Open commit View diff
14 email: z.string().email(),
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
15
  password: z.string().min(8),
Open commit View diff
15 password: z.string().min(8),
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
16
  displayName: z.string().min(2)
Open commit View diff
16 displayName: z.string().min(2)
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
17
});
Open commit View diff
17 });
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
18
Open commit View diff
18
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
19
export const authRouter = Router();
Open commit View diff
19 export const authRouter = Router();
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
20
Open commit View diff
20
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
21
authRouter.post("/register", async (req, res) => {
Open commit View diff
21 authRouter.post("/register", async (req, res) => {
Alex Nord 3 months ago 462c463

Add first-run setup and gate demo seed behind config

Full commit hash
462c463a79b4fe09e752f88c5c4eca69dac468fc
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
22
  const userCount = await pool.query(`SELECT COUNT(*)::int AS count FROM users`);
Open commit View diff
22 const userCount = await pool.query(`SELECT COUNT(*)::int AS count FROM users`);
same change 462c463

Add first-run setup and gate demo seed behind config

Full commit hash
462c463a79b4fe09e752f88c5c4eca69dac468fc
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
23
  if (userCount.rows[0].count === 0) {
Open commit View diff
23 if (userCount.rows[0].count === 0) {
same change 462c463

Add first-run setup and gate demo seed behind config

Full commit hash
462c463a79b4fe09e752f88c5c4eca69dac468fc
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
24
    return res.status(403).json({ error: "Complete initial Ledger setup first" });
Open commit View diff
24 return res.status(403).json({ error: "Complete initial Ledger setup first" });
same change 462c463

Add first-run setup and gate demo seed behind config

Full commit hash
462c463a79b4fe09e752f88c5c4eca69dac468fc
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
25
  }
Open commit View diff
25 }
same change 462c463

Add first-run setup and gate demo seed behind config

Full commit hash
462c463a79b4fe09e752f88c5c4eca69dac468fc
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
26
Open commit View diff
26
Alex Nord 3 months ago 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
27
  const input = registerSchema.parse(req.body);
Open commit View diff
27 const input = registerSchema.parse(req.body);
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
28
  const existing = await pool.query(`SELECT id FROM users WHERE email = $1`, [input.email]);
Open commit View diff
28 const existing = await pool.query(`SELECT id FROM users WHERE email = $1`, [input.email]);
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
29
Open commit View diff
29
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
30
  if (existing.rowCount) {
Open commit View diff
30 if (existing.rowCount) {
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
31
    return res.status(409).json({ error: "User already exists" });
Open commit View diff
31 return res.status(409).json({ error: "User already exists" });
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
32
  }
Open commit View diff
32 }
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
33
Open commit View diff
33
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
34
  const role = await pool.query(`SELECT id FROM roles WHERE key = 'viewer'`);
Open commit View diff
34 const role = await pool.query(`SELECT id FROM roles WHERE key = 'viewer'`);
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
35
  const user = await pool.query(
Open commit View diff
35 const user = await pool.query(
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
36
    `
Open commit View diff
36 `
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
37
      INSERT INTO users (email, password_hash, display_name, primary_role_id)
Open commit View diff
37 INSERT INTO users (email, password_hash, display_name, primary_role_id)
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
38
      VALUES ($1, $2, $3, $4)
Open commit View diff
38 VALUES ($1, $2, $3, $4)
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
39
      RETURNING id
Open commit View diff
39 RETURNING id
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
40
    `,
Open commit View diff
40 `,
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
41
    [input.email, await hashPassword(input.password), input.displayName, role.rows[0].id]
Open commit View diff
41 [input.email, await hashPassword(input.password), input.displayName, role.rows[0].id]
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
42
  );
Open commit View diff
42 );
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
43
Open commit View diff
43
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
44
  const sessionUser = await getUserForSession(user.rows[0].id);
Open commit View diff
44 const sessionUser = await getUserForSession(user.rows[0].id);
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
45
  const token = createSessionToken(sessionUser!);
Open commit View diff
45 const token = createSessionToken(sessionUser!);
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
46
Open commit View diff
46
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
47
  res.cookie(env.SESSION_COOKIE_NAME, token, {
Open commit View diff
47 res.cookie(env.SESSION_COOKIE_NAME, token, {
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
48
    httpOnly: true,
Open commit View diff
48 httpOnly: true,
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
49
    sameSite: "lax",
Open commit View diff
49 sameSite: "lax",
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
50
    secure: isProduction
Open commit View diff
50 secure: isProduction
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
51
  });
Open commit View diff
51 });
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
52
Open commit View diff
52
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
53
  await logAudit(sessionUser!.id, "auth.register", "user", sessionUser!.id, {
Open commit View diff
53 await logAudit(sessionUser!.id, "auth.register", "user", sessionUser!.id, {
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
54
    email: sessionUser!.email
Open commit View diff
54 email: sessionUser!.email
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
55
  });
Open commit View diff
55 });
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
56
Open commit View diff
56
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
57
  return res.status(201).json({ user: sessionUser });
Open commit View diff
57 return res.status(201).json({ user: sessionUser });
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
58
});
Open commit View diff
58 });
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
59
Open commit View diff
59
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
60
authRouter.post("/login", async (req, res) => {
Open commit View diff
60 authRouter.post("/login", async (req, res) => {
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
61
  const input = loginSchema.parse(req.body);
Open commit View diff
61 const input = loginSchema.parse(req.body);
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
62
  const user = await pool.query(
Open commit View diff
62 const user = await pool.query(
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
63
    `
Open commit View diff
63 `
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
64
      SELECT u.id, u.password_hash
Open commit View diff
64 SELECT u.id, u.password_hash
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
65
      FROM users u
Open commit View diff
65 FROM users u
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
66
      WHERE u.email = $1 AND u.is_active = true
Open commit View diff
66 WHERE u.email = $1 AND u.is_active = true
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
67
    `,
Open commit View diff
67 `,
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
68
    [input.email]
Open commit View diff
68 [input.email]
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
69
  );
Open commit View diff
69 );
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
70
Open commit View diff
70
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
71
  if (!user.rowCount || !user.rows[0].password_hash) {
Open commit View diff
71 if (!user.rowCount || !user.rows[0].password_hash) {
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
72
    return res.status(401).json({ error: "Invalid credentials" });
Open commit View diff
72 return res.status(401).json({ error: "Invalid credentials" });
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
73
  }
Open commit View diff
73 }
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
74
Open commit View diff
74
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
75
  const passwordValid = await verifyPassword(input.password, user.rows[0].password_hash);
Open commit View diff
75 const passwordValid = await verifyPassword(input.password, user.rows[0].password_hash);
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
76
  if (!passwordValid) {
Open commit View diff
76 if (!passwordValid) {
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
77
    return res.status(401).json({ error: "Invalid credentials" });
Open commit View diff
77 return res.status(401).json({ error: "Invalid credentials" });
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
78
  }
Open commit View diff
78 }
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
79
Open commit View diff
79
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
80
  const sessionUser = await getUserForSession(user.rows[0].id);
Open commit View diff
80 const sessionUser = await getUserForSession(user.rows[0].id);
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
81
  const token = createSessionToken(sessionUser!);
Open commit View diff
81 const token = createSessionToken(sessionUser!);
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
82
Open commit View diff
82
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
83
  res.cookie(env.SESSION_COOKIE_NAME, token, {
Open commit View diff
83 res.cookie(env.SESSION_COOKIE_NAME, token, {
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
84
    httpOnly: true,
Open commit View diff
84 httpOnly: true,
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
85
    sameSite: "lax",
Open commit View diff
85 sameSite: "lax",
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
86
    secure: isProduction
Open commit View diff
86 secure: isProduction
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
87
  });
Open commit View diff
87 });
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
88
Open commit View diff
88
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
89
  await logAudit(sessionUser!.id, "auth.login", "user", sessionUser!.id);
Open commit View diff
89 await logAudit(sessionUser!.id, "auth.login", "user", sessionUser!.id);
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
90
  return res.json({ user: sessionUser });
Open commit View diff
90 return res.json({ user: sessionUser });
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
91
});
Open commit View diff
91 });
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
92
Open commit View diff
92
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
93
authRouter.post("/logout", async (_req, res) => {
Open commit View diff
93 authRouter.post("/logout", async (_req, res) => {
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
94
  res.clearCookie(env.SESSION_COOKIE_NAME);
Open commit View diff
94 res.clearCookie(env.SESSION_COOKIE_NAME);
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
95
  return res.status(204).send();
Open commit View diff
95 return res.status(204).send();
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
96
});
Open commit View diff
96 });
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
97
Open commit View diff
97
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
98
authRouter.get("/session", async (req, res) => {
Open commit View diff
98 authRouter.get("/session", async (req, res) => {
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
99
  return res.json({ user: req.user ?? null });
Open commit View diff
99 return res.json({ user: req.user ?? null });
same change 4527dbd

First commit v2

Full commit hash
4527dbdfcb1470a5c2476e2a5208f7bf48cc9d27
Author
Alex Nord <[email protected]>
Date
3 months ago
Selected line
100
});
Open commit View diff
100 });