Finished up with global user bans.

This commit is contained in:
rainbow napkin 2024-11-29 15:39:53 -05:00
parent 26df91262f
commit 8fc699924e
13 changed files with 180 additions and 37 deletions

View file

@ -27,10 +27,12 @@ module.exports.authenticateSession = async function(user, pass, req){
const banDB = await userBanModel.checkBanByUserDoc(userDB);
if(banDB){
//Make the number a little prettier despite the lack of precision since we're not doing calculations here :P
const expiration = banDB.getDaysUntilExpiration() < 1 ? 0 : banDB.getDaysUntilExpiration();
if(banDB.permanent){
throw new Error(`Your account has been banned, and will be permanently deleted in: ${banDB.getDaysUntilExpiration()} day(s)`);
throw new Error(`Your account has been banned, and will be permanently deleted in: ${expiration} day(s)`);
}else{
throw new Error(`Your account has been temporarily banned, and will be reinstated in: ${banDB.getDaysUntilExpiration()} day(s)`);
throw new Error(`Your account has been temporarily banned, and will be reinstated in: ${expiration} day(s)`);
}
}