Use same mastodon regex for usernames
This commit is contained in:
parent
f59462eca4
commit
35a0a92483
1 changed files with 3 additions and 3 deletions
|
@ -27,9 +27,9 @@ function isUserVideoQuotaDailyValid (value: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isUserUsernameValid (value: string) {
|
function isUserUsernameValid (value: string) {
|
||||||
const max = USERS_CONSTRAINTS_FIELDS.USERNAME.max
|
return exists(value) &&
|
||||||
const min = USERS_CONSTRAINTS_FIELDS.USERNAME.min
|
validator.matches(value, new RegExp(`^[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?$`)) &&
|
||||||
return exists(value) && validator.matches(value, new RegExp(`^[a-z0-9._]{${min},${max}}$`))
|
validator.isLength(value, USERS_CONSTRAINTS_FIELDS.USERNAME)
|
||||||
}
|
}
|
||||||
|
|
||||||
function isUserDisplayNameValid (value: string) {
|
function isUserDisplayNameValid (value: string) {
|
||||||
|
|
Loading…
Reference in a new issue