Validate registrar's billing email (#1253)

Previously it was being validated only if contact email changed (contact
and billing emails have nothing in common).
This commit is contained in:
Artur Beljajev 2019-07-08 13:45:45 +03:00 committed by Georg
parent 1dfe30ccfd
commit 9bb73b7cdd
2 changed files with 19 additions and 3 deletions

View file

@ -32,9 +32,9 @@ class Registrar < ActiveRecord::Base
attribute :vat_rate, ::Type::VATRate.new
after_initialize :set_defaults
validates :email, :billing_email,
email_format: { message: :invalid },
allow_blank: true, if: proc { |c| c.email_changed? }
validates :email, email_format: { message: :invalid },
allow_blank: true, if: proc { |c| c.email_changed? }
validates :billing_email, email_format: { message: :invalid }, allow_blank: true
WHOIS_TRIGGERS = %w(name email phone street city state zip)