diff options
author | Akshay <[email protected]> | 2024-11-15 21:25:27 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2024-11-15 21:25:27 +0000 |
commit | c5cd65eba355e66589298cbe88fe3489e0fcebae (patch) | |
tree | 4050c946c4611e88c51efbb61cc44903fca5fd82 /src/routes/index.js | |
parent | d4a83cb44dc98fe78f9061408137a43049344b1d (diff) |
invalidate registered tokens properly
Diffstat (limited to 'src/routes/index.js')
-rw-r--r-- | src/routes/index.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/routes/index.js b/src/routes/index.js index 8529595..6efeb79 100644 --- a/src/routes/index.js +++ b/src/routes/index.js | |||
@@ -20,7 +20,6 @@ router.get("/", authenticateToken, async (req, res) => { | |||
20 | res.redirect("/r/all"); | 20 | res.redirect("/r/all"); |
21 | } else { | 21 | } else { |
22 | const p = subs.map((s) => s.subreddit).join("+"); | 22 | const p = subs.map((s) => s.subreddit).join("+"); |
23 | console.log(p); | ||
24 | res.redirect(`/r/${p}`); | 23 | res.redirect(`/r/${p}`); |
25 | } | 24 | } |
26 | }); | 25 | }); |
@@ -143,7 +142,9 @@ router.post("/register", validateInviteToken, async (req, res) => { | |||
143 | try { | 142 | try { |
144 | const hashedPassword = await Bun.password.hash(password); | 143 | const hashedPassword = await Bun.password.hash(password); |
145 | 144 | ||
146 | db.query("UPDATE invites SET usedAt = CURRENT_TIMESTAMP WHERE id = $id", { | 145 | db.query( |
146 | "UPDATE invites SET usedAt = CURRENT_TIMESTAMP WHERE id = $id", | ||
147 | ).run({ | ||
147 | id: req.invite.id, | 148 | id: req.invite.id, |
148 | }); | 149 | }); |
149 | 150 | ||
@@ -165,7 +166,6 @@ router.post("/register", validateInviteToken, async (req, res) => { | |||
165 | }) | 166 | }) |
166 | .redirect("/"); | 167 | .redirect("/"); |
167 | } catch (err) { | 168 | } catch (err) { |
168 | console.log(err); | ||
169 | return res.render("register", { | 169 | return res.render("register", { |
170 | message: "error registering user, try again later", | 170 | message: "error registering user, try again later", |
171 | }); | 171 | }); |