Verified Commit 35a0a924 authored by Chocobozzz's avatar Chocobozzz
Browse files

Use same mastodon regex for usernames

parent f59462ec
......@@ -27,9 +27,9 @@ function isUserVideoQuotaDailyValid (value: string) {
}
function isUserUsernameValid (value: string) {
const max = USERS_CONSTRAINTS_FIELDS.USERNAME.max
const min = USERS_CONSTRAINTS_FIELDS.USERNAME.min
return exists(value) && validator.matches(value, new RegExp(`^[a-z0-9._]{${min},${max}}$`))
return exists(value) &&
validator.matches(value, new RegExp(`^[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?$`)) &&
validator.isLength(value, USERS_CONSTRAINTS_FIELDS.USERNAME)
}
function isUserDisplayNameValid (value: string) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment