Archived
2

added /user DELETE route

This commit is contained in:
VLE2FE
2020-04-27 15:10:14 +02:00
parent 1eff39bb16
commit 5a911a455b
6 changed files with 239 additions and 73 deletions

View File

@ -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;
}
}