summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/user.rb3
-rw-r--r--test/unit/user_test.rb6
2 files changed, 8 insertions, 1 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 7180191d9..88e18b8d0 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -110,7 +110,8 @@ class User < Principal
# Login must contain letters, numbers, underscores only
validates_format_of :login, :with => /\A[a-z0-9_\-@\.]*\z/i
validates_length_of :login, :maximum => LOGIN_LENGTH_LIMIT
- validates_length_of :firstname, :lastname, :maximum => 30
+ validates_length_of :firstname, :maximum => 30
+ validates_length_of :lastname, :maximum => 255
validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
Setting::PASSWORD_CHAR_CLASSES.each do |k, v|
validates_format_of :password, :with => v, :message => :"must_contain_#{k}", :allow_blank => true, :if => Proc.new {Setting.password_required_char_classes.include?(k)}
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
index 704728a60..4199ce003 100644
--- a/test/unit/user_test.rb
+++ b/test/unit/user_test.rb
@@ -577,6 +577,12 @@ class UserTest < ActiveSupport::TestCase
end
end
+ def test_lastname_should_accept_255_characters
+ u = User.first
+ u.lastname = 'a' * 255
+ assert u.save
+ end
+
def test_today_should_return_the_day_according_to_user_time_zone
preference = User.find(1).pref
date = Date.new(2012, 05, 15)