Validate contact and invoice emails when they change #2745

This commit is contained in:
Priit Tark 2015-08-06 13:21:15 +03:00
parent c482a3e46d
commit 6ca53f946a
7 changed files with 43 additions and 2 deletions

View file

@ -45,7 +45,9 @@ class Registrar < ActiveRecord::Base
end
end
validates :email, :billing_email, format: /@/, allow_blank: true
validates :email, :billing_email,
email_format: { message: :invalid },
allow_blank: true, if: proc { |c| c.email_changed? }
WHOIS_TRIGGERS = %w(name email phone street city state zip)