Finished up with global user bans.
This commit is contained in:
parent
26df91262f
commit
8fc699924e
13 changed files with 180 additions and 37 deletions
|
|
@ -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)`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue