Added user rank changes to admin page.
This commit is contained in:
parent
064109556c
commit
8a4a21cff0
13 changed files with 276 additions and 30 deletions
|
|
@ -17,6 +17,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
|||
//NPM Imports
|
||||
const { check, body, checkSchema, checkExact} = require('express-validator');
|
||||
|
||||
//local imports
|
||||
const permissionSchema = require("../schemas/permissionSchema");
|
||||
|
||||
function isRank(value){
|
||||
rankVal = permissionSchema.rankToNum(value);
|
||||
|
||||
return rankVal != -1;
|
||||
}
|
||||
|
||||
module.exports.accountValidator = {
|
||||
user: (field = 'user') => body(field).escape().trim().isLength({min: 1, max: 22}),
|
||||
|
||||
|
|
@ -32,6 +41,8 @@ module.exports.accountValidator = {
|
|||
signature: (field = 'signature') => body(field).optional().escape().trim().isLength({min: 1, max: 150}),
|
||||
|
||||
bio: (field = 'bio') => body(field).optional().escape().trim().isLength({min: 1, max: 1000}),
|
||||
|
||||
rank: (field = 'rank') => body(field).escape().trim().custom(isRank)
|
||||
}
|
||||
|
||||
module.exports.channelValidator = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue