aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-09-04 20:07:54 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-09-04 20:07:54 +0200
commitb0f9f39ed70299a208d1b388c72de8b7f3510cb7 (patch)
tree4b7d388125265533ac2f6d4bf457d018617e1db6 /server/helpers/custom-validators
parente7dbeae8d915cdf4470ceb51c2724b04148b30b5 (diff)
downloadPeerTube-b0f9f39ed70299a208d1b388c72de8b7f3510cb7.tar.gz
PeerTube-b0f9f39ed70299a208d1b388c72de8b7f3510cb7.tar.zst
PeerTube-b0f9f39ed70299a208d1b388c72de8b7f3510cb7.zip
Begin user quota
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}