Imrpoved IP Ban Messages
This commit is contained in:
parent
730d816c45
commit
8305494915
|
|
@ -101,8 +101,20 @@ module.exports = class{
|
||||||
|
|
||||||
//If this ip is randy bobandy
|
//If this ip is randy bobandy
|
||||||
if(ipBanDB != null){
|
if(ipBanDB != null){
|
||||||
//tell it to fuck off
|
//Make the number a little prettier despite the lack of precision since we're not doing calculations here :P
|
||||||
socket.emit("kick", {type: "kicked", reason: "The IP address you are trying to connect from has been banned!"});
|
const expiration = ipBanDB.getDaysUntilExpiration() < 1 ? 0 : ipBanDB.getDaysUntilExpiration();
|
||||||
|
|
||||||
|
//If the ban is permanent
|
||||||
|
if(ipBanDB.permanent){
|
||||||
|
//tell it to fuck off
|
||||||
|
socket.emit("kick", {type: "kicked", reason: `The IP address you are trying to connect from has been permanently banned. Your cleartext IP has been saved to the database. Any associated accounts will be nuked in ${expiration} day(s).`});
|
||||||
|
//Otherwise
|
||||||
|
}else{
|
||||||
|
//tell it to fuck off
|
||||||
|
socket.emit("kick", {type: "kicked", reason: `The IP address you are trying to connect from has been temporarily banned. Your cleartext IP has been saved to the database until the ban expires in ${expiration} day(s).`});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,12 +61,32 @@ module.exports.post = async function(req, res){
|
||||||
|
|
||||||
//If this ip is randy bobandy
|
//If this ip is randy bobandy
|
||||||
if(ipBanDB != null){
|
if(ipBanDB != null){
|
||||||
//Make the code and message look pretty (kinda) at the same time
|
|
||||||
const banMsg = [
|
//Make the number a little prettier despite the lack of precision since we're not doing calculations here :P
|
||||||
'The IP address you are trying to register an account from has been banned.',
|
const expiration = ipBanDB.getDaysUntilExpiration() < 1 ? 0 : ipBanDB.getDaysUntilExpiration();
|
||||||
'If you beleive this to be an error feel free to reach out to your server administrator.',
|
let banMsg = [];
|
||||||
'Otherwise, fuck off :)'
|
|
||||||
];
|
//If the ban is permanent
|
||||||
|
if(ipBanDB.permanent){
|
||||||
|
//tell it to fuck off
|
||||||
|
//Make the code and message look pretty (kinda) at the same time
|
||||||
|
banMsg = [
|
||||||
|
'The IP address you are trying to register an account from has been permanently banned.',
|
||||||
|
'Your cleartext IP has been saved to the database.',
|
||||||
|
`Any associated accounts will be nuked in ${expiration} day(s).`,
|
||||||
|
'If you beleive this to be an error feel free to reach out to your server administrator.',
|
||||||
|
'Otherwise, fuck off :)'
|
||||||
|
];
|
||||||
|
}else{
|
||||||
|
//tell it to fuck off
|
||||||
|
//Make the code and message look pretty (kinda) at the same time
|
||||||
|
banMsg = [
|
||||||
|
'The IP address you are trying to register an account from has been temporarily banned.',
|
||||||
|
`Your cleartext IP has been saved to the database until the ban expires in ${expiration} day(s).`,
|
||||||
|
'If you beleive this to be an error feel free to reach out to your server administrator.',
|
||||||
|
'Otherwise, fuck off :)'
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
//tell it to fuck off
|
//tell it to fuck off
|
||||||
return errorHandler(res, banMsg.join('<br>'), 'unauthorized');
|
return errorHandler(res, banMsg.join('<br>'), 'unauthorized');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue