Allow hyphens in username (#99)

This commit is contained in:
Alex Ling 2020-09-12 05:26:45 +00:00
parent 220fc42bf2
commit a68f3eea95

View File

@ -2,9 +2,9 @@ def validate_username(username)
if username.size < 3
raise "Username should contain at least 3 characters"
end
if (username =~ /^[A-Za-z0-9_]+$/).nil?
raise "Username should contain alphanumeric characters " \
"and underscores only"
if (username =~ /^[a-zA-Z_][a-zA-Z0-9_\-]*$/).nil?
raise "Username can only contain alphanumeric characters, " \
"underscores, and hyphens"
end
end