]> source.dussan.org Git - redmine.git/commitdiff
Raise the maximum length of the last name to 255 characters (#37679).
authorGo MAEDA <maeda@farend.jp>
Sun, 27 Aug 2023 08:59:33 +0000 (08:59 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 27 Aug 2023 08:59:33 +0000 (08:59 +0000)
Patch by Anthony Mallet.

git-svn-id: https://svn.redmine.org/redmine/trunk@22284 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/user.rb
test/unit/user_test.rb

index 7180191d931e09511d12aa96495855b249eb0778..88e18b8d05be3e98a4b5cef1c3b7b4c47bd93d35 100644 (file)
@@ -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)}
index 704728a605b9541acea6172ad9496e6b623ef08a..4199ce003a2d835885b25a32b2f3ff0e298503c3 100644 (file)
@@ -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)