diff --git a/src/schemas/user/userBanSchema.js b/src/schemas/user/userBanSchema.js
index 947730d..8af9502 100644
--- a/src/schemas/user/userBanSchema.js
+++ b/src/schemas/user/userBanSchema.js
@@ -306,24 +306,31 @@ userBanSchema.statics.unban = async function(user){
}
userBanSchema.statics.getBans = async function(){
- const banDB = await this.find({}).populate('user');
+ //Get the ban, populating users and alts
+ const banDB = await this.find({}).populate('user').populate('alts');
+ //Create an empty array to hold ban records
var bans = [];
banDB.forEach((ban) => {
- //Calcualte expiration date
+ //Create array to hold alts
+ var alts = [];
+ //Calculate expiration date
var expirationDate = new Date(ban.banDate);
expirationDate.setDate(expirationDate.getDate() + ban.expirationDays);
//Make sure we're not about to read the properties of a null object
if(ban.user != null){
- var userObj = {
- id: ban.user.id,
- user: ban.user.user,
- img: ban.user.img,
- date: ban.user.date
- }
+ var userObj = ban.user.getProfile();
}
+
+ //For each alt in the ban
+ for(alt of ban.alts){
+ //Get the profile and push it to the alt list
+ alts.push(alt.getProfile());
+ }
+
+ //Create ban object
const banObj = {
banDate: ban.banDate,
expirationDays: ban.expirationDays,
@@ -331,14 +338,16 @@ userBanSchema.statics.getBans = async function(){
daysUntilExpiration: ban.getDaysUntilExpiration(),
user: userObj,
ips: ban.ips,
- alts: ban.alts,
+ alts,
deletedNames: ban.deletedNames,
permanent: ban.permanent
}
+ //Add it to the array
bans.push(banObj);
});
+ //Return the array
return bans;
}
diff --git a/src/schemas/user/userSchema.js b/src/schemas/user/userSchema.js
index ab84e66..0e3d271 100644
--- a/src/schemas/user/userSchema.js
+++ b/src/schemas/user/userSchema.js
@@ -74,22 +74,23 @@ const userSchema = new mongoose.Schema({
required: true,
default: "/img/johnny.png"
},
+ //These should be larger than validator values to make room for escaped characters
bio: {
type: mongoose.SchemaTypes.String,
required: true,
- maxLength: 1000,
+ maxLength: 2000,
default: "Bio not set!"
},
pronouns:{
type: mongoose.SchemaTypes.String,
optional: true,
- maxLength: 20,
+ maxLength: 50,
default: ""
},
signature: {
type: mongoose.SchemaTypes.String,
required: true,
- maxLength: 150,
+ maxLength: 300,
default: "Signature not set!"
},
highLevel: {
diff --git a/src/validators/accountValidator.js b/src/validators/accountValidator.js
index 377ecbf..9d1e9ed 100644
--- a/src/validators/accountValidator.js
+++ b/src/validators/accountValidator.js
@@ -32,11 +32,12 @@ module.exports = {
img: (field = 'img') => body(field).optional().isURL({require_tld: false, require_host: false}).trim(),
- pronouns: (field = 'pronouns') => body(field).optional().escape().trim().isLength({min: 0, max: 15}),
+ //Length check before escaping to keep symbols from throwing the count
+ pronouns: (field = 'pronouns') => body(field).optional().trim().isLength({min: 0, max: 15}).escape(),
- signature: (field = 'signature') => body(field).optional().escape().trim().isLength({min: 1, max: 25}),
+ signature: (field = 'signature') => body(field).optional().trim().isLength({min: 1, max: 25}).escape(),
- bio: (field = 'bio') => body(field).optional().escape().trim().isLength({min: 1, max: 1000}),
+ bio: (field = 'bio') => body(field).optional().trim().isLength({min: 1, max: 1000}).escape(),
rank: (field = 'rank') => body(field).escape().trim().custom(isRank),
diff --git a/src/views/partial/adminPanel/userBanList.ejs b/src/views/partial/adminPanel/userBanList.ejs
index 50666ba..d17db95 100644
--- a/src/views/partial/adminPanel/userBanList.ejs
+++ b/src/views/partial/adminPanel/userBanList.ejs
@@ -18,17 +18,17 @@ along with this program. If not, see
- Img+ |
+ Main
+ |
+
+ Alt
+ |
+
+ Nuked
|
-
- ID- |
-
- Name- |
-
- Sign-Up
+ |
+ Banned
|
Ban
diff --git a/src/views/partial/popup/userBan.ejs b/src/views/partial/popup/userBan.ejs
index 94e6c72..b3c91c4 100644
--- a/src/views/partial/popup/userBan.ejs
+++ b/src/views/partial/popup/userBan.ejs
@@ -16,6 +16,10 @@ along with this program. If not, see |