Skip to content

Commit

Permalink
add length validation from last_name and first_name
Browse files Browse the repository at this point in the history
  • Loading branch information
usernaimandrey committed Nov 13, 2023
1 parent ee61aef commit c9a7cd1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/forms/web/account/profile_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ class Web::Account::ProfileForm < User
include ActiveFormModel
include UserPresenter

validates :first_name, :last_name, presence: true
validates :first_name, presence: true, length: { maximum: 40 }
validates :last_name, presence: true, length: { maximum: 40 }

fields :first_name, :last_name, :about
end
3 changes: 2 additions & 1 deletion app/forms/web/admin/user_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ class Web::Admin::UserForm < User
include ActiveFormModel
include UserPresenter

validates :last_name, :first_name, presence: true
validates :first_name, presence: true, length: { maximum: 40 }
validates :last_name, presence: true, length: { maximum: 40 }

fields :state_event,
:role,
Expand Down
1 change: 1 addition & 0 deletions app/forms/web/user_registration_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Web::UserRegistrationForm < User
include ActiveFormModel

validates :first_name, :last_name, :email, :password, :password_confirmation, presence: true
validates :first_name, :last_name, length: { maximum: 40 }
validates :email, 'valid_email_2/email': true

fields :first_name,
Expand Down

0 comments on commit c9a7cd1

Please sign in to comment.