diff --git a/Gemfile b/Gemfile index e944789eef..3df788509a 100644 --- a/Gemfile +++ b/Gemfile @@ -25,6 +25,8 @@ gem "activerecord-import" gem "db2fog", github: "openfoodfoundation/db2fog", branch: "rails-6" gem "fog-aws", "~> 2.0" # db2fog does not support v3 +gem "valid_email2" + gem "catalog", path: "./engines/catalog" gem 'dfc_provider', path: './engines/dfc_provider' gem "order_management", path: "./engines/order_management" diff --git a/Gemfile.lock b/Gemfile.lock index abce394c01..dcbb6f0cd5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -633,6 +633,9 @@ GEM get_process_mem (~> 0) unicorn (>= 4, < 7) uniform_notifier (1.14.2) + valid_email2 (4.0.0) + activemodel (>= 3.2) + mail (~> 2.5) view_component (2.35.0) activesupport (>= 5.0.0, < 8.0) method_source (~> 1.0) @@ -792,6 +795,7 @@ DEPENDENCIES uglifier (>= 1.0.3) unicorn-rails unicorn-worker-killer + valid_email2 view_component view_component_storybook web! diff --git a/app/models/customer.rb b/app/models/customer.rb index 9d38bc7427..43bc2cf9e8 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -20,7 +20,7 @@ class Customer < ApplicationRecord before_validation :empty_code validates :code, uniqueness: { scope: :enterprise_id, allow_nil: true } - validates :email, presence: true, + validates :email, presence: true, 'valid_email_2/email': true, uniqueness: { scope: :enterprise_id, message: I18n.t('validation_msg_is_associated_with_an_exising_customer') } validates :enterprise, presence: true