mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 09:21:43 +02:00
Validate uniqueness manually all the time
This commit is contained in:
parent
0ab1e29a53
commit
3f8f5cc4cd
5 changed files with 17 additions and 14 deletions
|
@ -48,6 +48,8 @@ module Epp::Common
|
|||
# for debugging
|
||||
@errors << { code: '1', msg: 'handle_errors was executed when there were actually no errors' } if @errors.blank?
|
||||
|
||||
@errors.uniq!
|
||||
|
||||
render '/epp/error'
|
||||
end
|
||||
|
||||
|
|
|
@ -45,9 +45,9 @@ class Domain < ActiveRecord::Base
|
|||
validate :validate_period
|
||||
validate :validate_nameservers_count
|
||||
validate :validate_admin_contacts_count
|
||||
validate :validate_nameservers_uniqueness, if: :new_record?
|
||||
validate :validate_tech_contacts_uniqueness, if: :new_record?
|
||||
validate :validate_admin_contacts_uniqueness, if: :new_record?
|
||||
validate :validate_nameservers_uniqueness
|
||||
validate :validate_tech_contacts_uniqueness
|
||||
validate :validate_admin_contacts_uniqueness
|
||||
validate :validate_domain_statuses_uniqueness
|
||||
|
||||
attr_accessor :owner_contact_typeahead
|
||||
|
|
|
@ -18,7 +18,6 @@ class DomainContact < ActiveRecord::Base
|
|||
TYPES = [TECH, ADMIN]
|
||||
|
||||
validates :contact, presence: true
|
||||
validates :contact, uniqueness: { scope: [:domain_id, :contact_type] }
|
||||
|
||||
scope :admin, -> { where(contact_type: ADMIN) }
|
||||
scope :tech, -> { where(contact_type: TECH) }
|
||||
|
|
|
@ -8,8 +8,6 @@ class Nameserver < ActiveRecord::Base
|
|||
validates :ipv4, format: { with: /\A(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\z/, allow_blank: true }
|
||||
validates :ipv6, format: { with: /(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/, allow_blank: true }
|
||||
|
||||
validates :hostname, uniqueness: { scope: :domain_id }
|
||||
|
||||
def epp_code_map
|
||||
{
|
||||
'2302' => [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue