added /user DELETE route
This commit is contained in:
@ -25,6 +25,8 @@ export default class UserValidate { // validate input for user
|
||||
.allow('')
|
||||
};
|
||||
|
||||
private static specialUsernames = ['admin', 'user', 'key', 'new', 'passreset']; // names a user cannot take
|
||||
|
||||
static input (data, param) {
|
||||
if (param === 'new') {
|
||||
return joi.object({
|
||||
@ -71,4 +73,8 @@ export default class UserValidate { // validate input for user
|
||||
}).validate(data, {stripUnknown: true})
|
||||
return error !== undefined? null : value;
|
||||
}
|
||||
|
||||
static isSpecialName (name) { // true if name belongs to special names
|
||||
return this.specialUsernames.indexOf(name) > -1;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user