step 9.5: wip (not ticked)
This commit is contained in:
+13
-11
@@ -14,18 +14,20 @@ const loginSchema = zod.strictObject({
|
||||
password: zod.string().min(1).max(72),
|
||||
});
|
||||
|
||||
// Rate limiters
|
||||
const registerLimiter = rateLimit({
|
||||
windowMs: 60 * 60 * 1000, // 1 hour
|
||||
max: process.env.NODE_ENV === 'test' ? 1000 : 5,
|
||||
message: { ok: false, error: { code: 'RATE_LIMITED', message: 'Too many registration attempts. Try again later.' } },
|
||||
});
|
||||
// Rate limiters — temporarily disabled for debugging
|
||||
// const registerLimiter = rateLimit({
|
||||
// windowMs: 60 * 60 * 1000, // 1 hour
|
||||
// max: process.env.NODE_ENV === 'test' ? 1000 : 100,
|
||||
// message: { ok: false, error: { code: 'RATE_LIMITED', message: 'Too many registration attempts. Try again later.' } },
|
||||
// });
|
||||
|
||||
const loginLimiter = rateLimit({
|
||||
windowMs: 15 * 60 * 1000, // 15 minutes
|
||||
max: process.env.NODE_ENV === 'test' ? 1000 : 10,
|
||||
message: { ok: false, error: { code: 'RATE_LIMITED', message: 'Too many login attempts. Try again later.' } },
|
||||
});
|
||||
// const loginLimiter = rateLimit({
|
||||
// windowMs: 15 * 60 * 1000, // 15 minutes
|
||||
// max: process.env.NODE_ENV === 'test' ? 1000 : 100,
|
||||
// message: { ok: false, error: { code: 'RATE_LIMITED', message: 'Too many login attempts. Try again later.' } },
|
||||
// });
|
||||
const registerLimiter = (_req, _res, next) => next();
|
||||
const loginLimiter = (_req, _res, next) => next();
|
||||
|
||||
function wrap(fn) {
|
||||
return (req, res, next) => Promise.resolve(fn(req, res, next)).catch(next);
|
||||
|
||||
Reference in New Issue
Block a user