mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
Merge branch '111601356-ident_type_validation' into staging
This commit is contained in:
commit
642fc93b9b
2 changed files with 7 additions and 2 deletions
|
@ -33,7 +33,8 @@ class Contact < ActiveRecord::Base
|
||||||
uniqueness: { message: :epp_id_taken },
|
uniqueness: { message: :epp_id_taken },
|
||||||
format: { with: /\A[\w\-\:\.\_]*\z/i, message: :invalid },
|
format: { with: /\A[\w\-\:\.\_]*\z/i, message: :invalid },
|
||||||
length: { maximum: 100, message: :too_long_contact_code }
|
length: { maximum: 100, message: :too_long_contact_code }
|
||||||
validates :ident_type, inclusion: {in: %w( org priv birthday), message: :ident_type_invalid}
|
|
||||||
|
validate :val_ident_type
|
||||||
validate :val_ident_valid_format?
|
validate :val_ident_valid_format?
|
||||||
validate :uniq_statuses?
|
validate :uniq_statuses?
|
||||||
validate :validate_html
|
validate :validate_html
|
||||||
|
@ -246,6 +247,10 @@ class Contact < ActiveRecord::Base
|
||||||
name || '[no name]'
|
name || '[no name]'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def val_ident_type
|
||||||
|
errors.add(:ident_type, :epp_ident_type_invalid, code: code) if !%w(org priv birthday).include?(ident_type)
|
||||||
|
end
|
||||||
|
|
||||||
def val_ident_valid_format?
|
def val_ident_valid_format?
|
||||||
case ident_country_code
|
case ident_country_code
|
||||||
when 'EE'.freeze
|
when 'EE'.freeze
|
||||||
|
|
|
@ -133,7 +133,7 @@ class Epp::Contact < Contact
|
||||||
[:code, :epp_id_taken]
|
[:code, :epp_id_taken]
|
||||||
],
|
],
|
||||||
'2304' => [ # Object status prohibits operation
|
'2304' => [ # Object status prohibits operation
|
||||||
[:ident_type, :epp_ident_type_invalid, { value: { obj: 'code', val: code } }]
|
[:ident_type, :epp_ident_type_invalid, { value: { obj: 'code', val: code}, interpolation: {code: code}}]
|
||||||
],
|
],
|
||||||
'2305' => [ # Association exists
|
'2305' => [ # Association exists
|
||||||
[:domains, :exist]
|
[:domains, :exist]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue