diff options
Diffstat (limited to 'server/helpers/custom-validators/users.js')
-rw-r--r-- | server/helpers/custom-validators/users.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/users.js b/server/helpers/custom-validators/users.js new file mode 100644 index 000000000..41e00d046 --- /dev/null +++ b/server/helpers/custom-validators/users.js | |||
@@ -0,0 +1,18 @@ | |||
1 | 'use strict' | ||
2 | |||
3 | const validator = require('express-validator').validator | ||
4 | |||
5 | const constants = require('../../initializers/constants') | ||
6 | const USERS_CONSTRAINTS_FIELDS = constants.CONSTRAINTS_FIELDS.USERS | ||
7 | |||
8 | const usersValidators = { | ||
9 | isUserUsernameValid: isUserUsernameValid | ||
10 | } | ||
11 | |||
12 | function isUserUsernameValid (value) { | ||
13 | return validator.isLength(value, USERS_CONSTRAINTS_FIELDS.USERNAME) | ||
14 | } | ||
15 | |||
16 | // --------------------------------------------------------------------------- | ||
17 | |||
18 | module.exports = usersValidators | ||