mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 02:35:57 +02:00
Domain name presence validation
This commit is contained in:
parent
bfb9abea8c
commit
8882c36053
5 changed files with 19 additions and 7 deletions
|
@ -16,6 +16,7 @@ class DomainNameValidator < ActiveModel::EachValidator
|
|||
|
||||
class << self
|
||||
def validate_format(value)
|
||||
return true unless value
|
||||
value = value.mb_chars.downcase.strip
|
||||
|
||||
general_domains = /(.pri.ee|.com.ee|.fie.ee|.med.ee|.ee)/
|
||||
|
@ -33,7 +34,8 @@ class DomainNameValidator < ActiveModel::EachValidator
|
|||
!!(value =~ regexp)
|
||||
end
|
||||
|
||||
def validate_reservation(value)
|
||||
def validate_reservation(value)
|
||||
return true unless value
|
||||
!ReservedDomain.exists?(name: value.mb_chars.downcase.strip)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue