username now can only contain letters numbers, periods, and underscores
This commit is contained in:
parent
096a0308e1
commit
6913381781
2 changed files with 6 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue