From 9f5a636d726a199a34ecaf17fd092d114e04d3c5 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Thu, 4 Jun 2020 14:47:12 +0500 Subject: [PATCH] Change contact email validation --- app/models/contact.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/contact.rb b/app/models/contact.rb index f07c0c114..4b60e85be 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -7,6 +7,7 @@ class Contact < ApplicationRecord include Concerns::Contact::Transferable include Concerns::Contact::Identical include Concerns::Contact::Disclosable + include Concerns::EmailCheckable belongs_to :original, class_name: self.name belongs_to :registrar, required: true @@ -29,8 +30,7 @@ class Contact < ApplicationRecord validates :phone, presence: true, e164: true, phone: true - validates :email, format: /@/ - validates :email, email_format: { message: :invalid }, if: proc { |c| c.will_save_change_to_email? } + validate :correct_email_format, if: proc { |c| c.will_save_change_to_email? } validates :code, uniqueness: { message: :epp_id_taken },