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.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts
index b04970108..8a6f6fca1 100644
--- a/server/helpers/custom-validators/users.ts
+++ b/server/helpers/custom-validators/users.ts
@@ -27,9 +27,9 @@ function isUserVideoQuotaDailyValid (value: string) {
27} 27}
28 28
29function isUserUsernameValid (value: string) { 29function isUserUsernameValid (value: string) {
30 const max = USERS_CONSTRAINTS_FIELDS.USERNAME.max 30 return exists(value) &&
31 const min = USERS_CONSTRAINTS_FIELDS.USERNAME.min 31 validator.matches(value, new RegExp(`^[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?$`)) &&
32 return exists(value) && validator.matches(value, new RegExp(`^[a-z0-9._]{${min},${max}}$`)) 32 validator.isLength(value, USERS_CONSTRAINTS_FIELDS.USERNAME)
33} 33}
34 34
35function isUserDisplayNameValid (value: string) { 35function isUserDisplayNameValid (value: string) {