aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/users.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators/users.ts')
-rw-r--r--server/helpers/custom-validators/users.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts
index 4a0d79ae5..c3cdefd4e 100644
--- a/server/helpers/custom-validators/users.ts
+++ b/server/helpers/custom-validators/users.ts
@@ -42,6 +42,10 @@ function isUserBlockedValid (value: any) {
42 return isBooleanValid(value) 42 return isBooleanValid(value)
43} 43}
44 44
45function isUserBlockedReasonValid (value: any) {
46 return value === null || (exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.USERS.BLOCKED_REASON))
47}
48
45function isUserRoleValid (value: any) { 49function isUserRoleValid (value: any) {
46 return exists(value) && validator.isInt('' + value) && UserRole[value] !== undefined 50 return exists(value) && validator.isInt('' + value) && UserRole[value] !== undefined
47} 51}
@@ -59,6 +63,7 @@ function isAvatarFile (files: { [ fieldname: string ]: Express.Multer.File[] } |
59export { 63export {
60 isUserBlockedValid, 64 isUserBlockedValid,
61 isUserPasswordValid, 65 isUserPasswordValid,
66 isUserBlockedReasonValid,
62 isUserRoleValid, 67 isUserRoleValid,
63 isUserVideoQuotaValid, 68 isUserVideoQuotaValid,
64 isUserUsernameValid, 69 isUserUsernameValid,