diff --git a/publify_core/app/models/user.rb b/publify_core/app/models/user.rb index c9555abc18..226183e3c9 100644 --- a/publify_core/app/models/user.rb +++ b/publify_core/app/models/user.rb @@ -22,6 +22,7 @@ class User < ApplicationRecord validates :email, :login, presence: true validates :login, length: { in: 3..40 } validates_default_string_length :email, :text_filter_name + validates :name, length: { maximum: 2048 } belongs_to :resource, optional: true has_many :notifications, foreign_key: "notify_user_id" diff --git a/publify_core/spec/models/user_spec.rb b/publify_core/spec/models/user_spec.rb index a8457ef283..54ea166556 100644 --- a/publify_core/spec/models/user_spec.rb +++ b/publify_core/spec/models/user_spec.rb @@ -49,6 +49,10 @@ expect(user).to validate_length_of(:email).is_at_most(255) end + it "requires name to not be too long" do + expect(user).to validate_length_of(:name).is_at_most(2048) + end + it "requires first name to not be too long" do expect(user).to validate_length_of(:firstname).is_at_most(256) end