Disallow unicode whitespace in usernames (#2894).

This commit is contained in:
evazion
2017-02-25 01:47:57 -06:00
parent 4d87ac028b
commit 6966b74e18
4 changed files with 26 additions and 19 deletions

View File

@@ -187,6 +187,13 @@ class UserTest < ActiveSupport::TestCase
assert_equal(Danbooru.config.default_guest_name, User.id_to_name(-1))
end
should "not contain whitespace" do
# U+2007: https://en.wikipedia.org/wiki/Figure_space
user = FactoryGirl.build(:user, :name => "foo\u2007bar")
user.save
assert_equal(["Name cannot have whitespace or colons"], user.errors.full_messages)
end
should "not contain a colon" do
user = FactoryGirl.build(:user, :name => "a:b")
user.save