Validate contact phone for zeros

#386
This commit is contained in:
Artur Beljajev 2017-03-06 07:27:11 +02:00
parent 9a6f5939c4
commit bacf5f8d64
6 changed files with 152 additions and 12 deletions

View file

@ -22,8 +22,8 @@ class Contact < ActiveRecord::Base
validates :name, :phone, :email, :ident, :ident_type, :registrar, presence: true
validates :street, :city, :zip, :country_code, presence: true, if: 'self.class.address_processing?'
# Phone nr validation is very minimam in order to support legacy requirements
validates :phone, format: /\+[0-9]{1,3}\.[0-9]{1,14}?/
validates :phone, format: /\+[0-9]{1,3}\.[0-9]{1,14}?/, phone: true
validates :email, format: /@/
validates :email, email_format: { message: :invalid }, if: proc { |c| c.email_changed? }
validates :ident,