Skip to content
Snippets Groups Projects
Commit 69133817 authored by maxwell's avatar maxwell
Browse files

username now can only contain letters numbers, periods, and underscores

parent 096a0308
No related branches found
No related tags found
No related merge requests found
......@@ -43,8 +43,7 @@ class User
before_validation :strip_username, :on => :create
validates_presence_of :username
validates_uniqueness_of :username, :case_sensitive => false
validates_format_of :username, :without => /\s/
validates_format_of :username, :with => /\A[A-Za-z0-9_.]+\z/
validates_with InvitedUserValidator
one :person, :class_name => 'Person', :foreign_key => :owner_id
......
......@@ -73,6 +73,11 @@ describe User do
user = Factory.build(:user, :username => "bobby tables")
user.should_not be_valid
end
it 'can not contain non url safe characters' do
user = Factory.build(:user, :username => "kittens;")
user.should_not be_valid
end
end
describe "of email" do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment