Last patch today, I'm happy with this rn
This commit is contained in:
@@ -22,7 +22,7 @@ const route = async (req, res) => {
|
||||
//script throttle
|
||||
const throttle = await checkThrottle(req.body.email);
|
||||
if (throttle) {
|
||||
console.warn(`Spam attack detected: ${req.body.email} (${req.body.username})`);
|
||||
console.warn(`Spam Throttled\t${req.body.email} (${req.body.username})`);
|
||||
return res.status(401).send(throttle);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,16 +10,24 @@ module.exports = async (req, res, next) => {
|
||||
content: address,
|
||||
|
||||
expiry: {
|
||||
[Op.gt]: Date.now()
|
||||
[Op.or]: {
|
||||
//future or forever
|
||||
[Op.gt]: Date.now(),
|
||||
[Op.eq]: null,
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//log the access timestamp
|
||||
const date = new Date();
|
||||
|
||||
if (!!record) {
|
||||
console.log(`IP blocked\t${address}\t\t\t${date.toTimeString()}`);
|
||||
return res.status(403).send("IP address banned");
|
||||
}
|
||||
|
||||
console.log(`IP ${address}`);
|
||||
console.log(`IP allowed\t${address}\t\t\t${date.toTimeString()}`);
|
||||
|
||||
return next();
|
||||
};
|
||||
Reference in New Issue
Block a user