diff options
Diffstat (limited to 'server/helpers/custom-validators/users.ts')
-rw-r--r-- | server/helpers/custom-validators/users.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts index 56bc10b16..738d5cbbf 100644 --- a/server/helpers/custom-validators/users.ts +++ b/server/helpers/custom-validators/users.ts | |||
@@ -2,7 +2,7 @@ import 'express-validator' | |||
2 | import * as validator from 'validator' | 2 | import * as validator from 'validator' |
3 | import { UserRole } from '../../../shared' | 3 | import { UserRole } from '../../../shared' |
4 | import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers/constants' | 4 | import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers/constants' |
5 | import { exists, isBooleanValid, isFileValid } from './misc' | 5 | import { exists, isArray, isBooleanValid, isFileValid } from './misc' |
6 | import { values } from 'lodash' | 6 | import { values } from 'lodash' |
7 | 7 | ||
8 | const USERS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.USERS | 8 | const USERS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.USERS |
@@ -54,6 +54,10 @@ function isUserAutoPlayVideoValid (value: any) { | |||
54 | return isBooleanValid(value) | 54 | return isBooleanValid(value) |
55 | } | 55 | } |
56 | 56 | ||
57 | function isUserVideoLanguages (value: any) { | ||
58 | return value === null || (isArray(value) && value.length < CONSTRAINTS_FIELDS.USERS.VIDEO_LANGUAGES.max) | ||
59 | } | ||
60 | |||
57 | function isUserAdminFlagsValid (value: any) { | 61 | function isUserAdminFlagsValid (value: any) { |
58 | return exists(value) && validator.isInt('' + value) | 62 | return exists(value) && validator.isInt('' + value) |
59 | } | 63 | } |
@@ -84,6 +88,7 @@ export { | |||
84 | isUserVideosHistoryEnabledValid, | 88 | isUserVideosHistoryEnabledValid, |
85 | isUserBlockedValid, | 89 | isUserBlockedValid, |
86 | isUserPasswordValid, | 90 | isUserPasswordValid, |
91 | isUserVideoLanguages, | ||
87 | isUserBlockedReasonValid, | 92 | isUserBlockedReasonValid, |
88 | isUserRoleValid, | 93 | isUserRoleValid, |
89 | isUserVideoQuotaValid, | 94 | isUserVideoQuotaValid, |