Skip to content

Commit

Permalink
don't send forgot-password email if user doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianoFerrari committed Feb 21, 2024
1 parent 5a9d0d9 commit bf553c9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,12 @@ app.post('/logout', async (req, res) => {
app.post('/forgot-password', async (req, res) => {
let email = req.body.email;
try {
let user = userByEmail.run(email);
let user = userByEmail.get(email);

if (!user) {
res.status(404).send();
return;
}

let token = newToken();
user.resetToken = hashToken(token); // Consider not hashing token for test user, so we can check it
Expand Down

0 comments on commit bf553c9

Please sign in to comment.