Created
January 30, 2022 15:09
-
-
Save tadeaspetak/3712f6659c7116f6d137496ebfc25674 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const user = Users.findByEmail(params.email); | |
if (!user || !Users.verifyPassword(params.password, user)) { | |
await new Promise((resolve) => setTimeout(resolve, crypto.randomInt(11, 111))); // mitigate timing attacks | |
return res.status(401).json({ message: "Invalid credentials." }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment