Project

General

Profile

« Previous | Next » 

Revision 111a4083

Added by Ohad Levy almost 12 years ago

  • ID 111a4083f7d8cafb3138e48a70ce0636bf98d1c2

fixes #1613 - Email address format validation preventing admin user creation

View differences:

app/models/user.rb
validates_length_of :login, :maximum => 30
validates_format_of :firstname, :lastname, :with => /^[\w\s\'\-\.]*$/i, :allow_nil => true
validates_length_of :firstname, :lastname, :maximum => 30, :allow_nil => true
validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :allow_nil => true
validates_format_of :mail, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)*[a-z]{2,})$/i, :allow_nil => true
validates_length_of :mail, :maximum => 60, :allow_nil => true
before_destroy EnsureNotUsedBy.new(:hosts), :ensure_admin_is_not_deleted
test/unit/user_test.rb
assert !u.save
end
test "email domains with a single word should be allowed" do
u = User.new :auth_source => auth_sources(:one), :login => "root", :mail => "foo@localhost"
assert u.save
end
end

Also available in: Unified diff