aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-04-26 10:03:40 +0200
committerChocobozzz <me@florianbigard.com>2018-04-26 10:03:40 +0200
commited56ad1193bb5bb0a81fb843a11eb90d3fed9861 (patch)
tree64842447b4721978c69e1d2b3a964951c789c408 /server/helpers/custom-validators
parentd62cf3234ccfca0223a9639782635f0fb6594f8c (diff)
downloadPeerTube-ed56ad1193bb5bb0a81fb843a11eb90d3fed9861.tar.gz
PeerTube-ed56ad1193bb5bb0a81fb843a11eb90d3fed9861.tar.zst
PeerTube-ed56ad1193bb5bb0a81fb843a11eb90d3fed9861.zip
Add ability to update the user display name/description
Diffstat (limited to 'server/helpers/custom-validators')
-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 c0acb8218..b59b766de 100644
--- a/server/helpers/custom-validators/users.ts
+++ b/server/helpers/custom-validators/users.ts
@@ -22,6 +22,10 @@ function isUserUsernameValid (value: string) {
22 return exists(value) && validator.matches(value, new RegExp(`^[a-z0-9._]{${min},${max}}$`)) 22 return exists(value) && validator.matches(value, new RegExp(`^[a-z0-9._]{${min},${max}}$`))
23} 23}
24 24
25function isUserDisplayNameValid (value: string) {
26 return value === null || (exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.USERS.NAME))
27}
28
25function isUserDescriptionValid (value: string) { 29function isUserDescriptionValid (value: string) {
26 return value === null || (exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.USERS.DESCRIPTION)) 30 return value === null || (exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.USERS.DESCRIPTION))
27} 31}
@@ -60,6 +64,7 @@ export {
60 isUserUsernameValid, 64 isUserUsernameValid,
61 isUserNSFWPolicyValid, 65 isUserNSFWPolicyValid,
62 isUserAutoPlayVideoValid, 66 isUserAutoPlayVideoValid,
67 isUserDisplayNameValid,
63 isUserDescriptionValid, 68 isUserDescriptionValid,
64 isAvatarFile 69 isAvatarFile
65} 70}