Finished up with IP-Ban functionality on the back-end. Just need to finish up with UI.

This commit is contained in:
rainbow napkin 2025-01-01 17:36:43 -05:00
parent 756c42ceaa
commit 977e8e1e2e
16 changed files with 284 additions and 67 deletions

View file

@ -40,7 +40,7 @@ module.exports.post = async function(req, res){
try{
const validResult = validationResult(req);
if(validResult.isEmpty()){
const {user, permanent, expirationDays} = matchedData(req);
const {user, permanent, ipBan, expirationDays} = matchedData(req);
const userDB = await userModel.findOne({user});
if(userDB == null){
@ -54,7 +54,7 @@ module.exports.post = async function(req, res){
return errorHandler(res, 'You cannot ban peer/outranking users', 'Unauthorized', 401);
}
await banModel.banByUserDoc(userDB, permanent, expirationDays);
await banModel.banByUserDoc(userDB, permanent, expirationDays, ipBan);
res.status(200);
return res.send(await banModel.getBans());