diff --git a/app/javascript/dashboard/routes/dashboard/settings/agents/AddAgent.vue b/app/javascript/dashboard/routes/dashboard/settings/agents/AddAgent.vue index 8cc1a83e1..5c854f248 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/agents/AddAgent.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/agents/AddAgent.vue @@ -102,7 +102,7 @@ export default { validations: { agentName: { required, - minLength: minLength(4), + minLength: minLength(1), }, agentEmail: { required, diff --git a/app/javascript/dashboard/routes/dashboard/settings/agents/EditAgent.vue b/app/javascript/dashboard/routes/dashboard/settings/agents/EditAgent.vue index fe3c7c71e..71ef35a65 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/agents/EditAgent.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/agents/EditAgent.vue @@ -112,7 +112,7 @@ export default { validations: { agentName: { required, - minLength: minLength(4), + minLength: minLength(1), }, agentType: { required, diff --git a/app/javascript/dashboard/routes/dashboard/settings/profile/Index.vue b/app/javascript/dashboard/routes/dashboard/settings/profile/Index.vue index acb70a145..73b4ade40 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/profile/Index.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/profile/Index.vue @@ -136,6 +136,7 @@ export default { validations: { name: { required, + minLength: minLength(1), }, displayName: {}, email: { diff --git a/app/models/user.rb b/app/models/user.rb index 486475d09..63a3bd057 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -62,6 +62,7 @@ class User < ApplicationRecord # validates_uniqueness_of :email, scope: :account_id validates :email, :name, presence: true + validates_length_of :name, minimum: 1 has_many :account_users, dependent: :destroy has_many :accounts, through: :account_users diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 9ca4d8784..d9e31e686 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -9,6 +9,7 @@ RSpec.describe User do context 'validations' do it { is_expected.to validate_presence_of(:email) } it { is_expected.to validate_presence_of(:name) } + it { is_expected.to validate_length_of(:name).is_at_least(1) } end context 'associations' do