aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r--server/helpers/custom-validators/users.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts
index 2b37bdde8..00061f9df 100644
--- a/server/helpers/custom-validators/users.ts
+++ b/server/helpers/custom-validators/users.ts
@@ -15,6 +15,10 @@ function isUserRoleValid (value: string) {
15 return values(USER_ROLES).indexOf(value as UserRole) !== -1 15 return values(USER_ROLES).indexOf(value as UserRole) !== -1
16} 16}
17 17
18function isUserVideoQuotaValid (value: string) {
19 return exists(value) && validator.isInt(value + '', USERS_CONSTRAINTS_FIELDS.VIDEO_QUOTA)
20}
21
18function isUserUsernameValid (value: string) { 22function isUserUsernameValid (value: string) {
19 const max = USERS_CONSTRAINTS_FIELDS.USERNAME.max 23 const max = USERS_CONSTRAINTS_FIELDS.USERNAME.max
20 const min = USERS_CONSTRAINTS_FIELDS.USERNAME.min 24 const min = USERS_CONSTRAINTS_FIELDS.USERNAME.min
@@ -30,6 +34,7 @@ function isUserDisplayNSFWValid (value: any) {
30export { 34export {
31 isUserPasswordValid, 35 isUserPasswordValid,
32 isUserRoleValid, 36 isUserRoleValid,
37 isUserVideoQuotaValid,
33 isUserUsernameValid, 38 isUserUsernameValid,
34 isUserDisplayNSFWValid 39 isUserDisplayNSFWValid
35} 40}
@@ -39,6 +44,7 @@ declare module 'express-validator' {
39 isUserPasswordValid, 44 isUserPasswordValid,
40 isUserRoleValid, 45 isUserRoleValid,
41 isUserUsernameValid, 46 isUserUsernameValid,
42 isUserDisplayNSFWValid 47 isUserDisplayNSFWValid,
48 isUserVideoQuotaValid
43 } 49 }
44} 50}