fixed email undefined error on request email code

This commit is contained in:
miloschwartz
2025-09-10 14:20:25 -07:00
parent 56ee68d9f3
commit a0a612618e

View File

@@ -956,7 +956,7 @@ authRouter.post(
windowMs: 15 * 60 * 1000,
max: 15,
keyGenerator: (req) =>
`requestEmailVerificationCode:${req.body.email || ipKeyGenerator(req.ip || "")}`,
`requestEmailVerificationCode:${req.user?.email || ipKeyGenerator(req.ip || "")}`,
handler: (req, res, next) => {
const message = `You can only request an email verification code ${15} times every ${15} minutes. Please try again later.`;
return next(createHttpError(HttpCode.TOO_MANY_REQUESTS, message));