Skip to content

Commit

Permalink
fix reset token example
Browse files Browse the repository at this point in the history
  • Loading branch information
pilcrowonpaper committed Jan 23, 2024
1 parent 324fe75 commit 08cec29
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions docs/pages/guides/email-and-password/password-reset.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,12 @@ app.post("/reset-password/:token", async () => {

await db.beginTransaction();
const token = await db.table("password_reset_token").where("id", "=", verificationToken).get();
await db.table("password_reset_token").where("id", "=", verificationToken).delete();
if (token) {
await db.table("password_reset_token").where("id", "=", verificationToken).delete();
}
await db.commit();

if (!token) {
return new Response(null, {
status: 400
});
}
if (!isWithinExpirationDate(token.expires_at)) {
await db.table("password_reset_token").where("id", "=", token.id).delete();
if (!token || !isWithinExpirationDate(token.expires_at)) {
return new Response(null, {
status: 400
});
Expand Down

0 comments on commit 08cec29

Please sign in to comment.