mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 18:29:40 +02:00
Story#109590460 - update country code validation
This commit is contained in:
parent
2b4de9a5c2
commit
ffb8bc61dd
1 changed files with 2 additions and 2 deletions
|
@ -218,8 +218,8 @@ class Contact < ActiveRecord::Base
|
||||||
when 'priv'.freeze
|
when 'priv'.freeze
|
||||||
errors.add(:ident, :invalid_EE_identity_format) unless Isikukood.new(ident).valid?
|
errors.add(:ident, :invalid_EE_identity_format) unless Isikukood.new(ident).valid?
|
||||||
when 'org'.freeze
|
when 'org'.freeze
|
||||||
last_char = ident.last
|
# !%w(1 7 8 9).freeze.include?(ident.first) ||
|
||||||
if ident.size != 8 || !%w(1 8 9).freeze.include?(last_char) || ident !=~/\A[12][0-9]{6}[189]\z/
|
if ident.size != 8 || ident !=~/\A[0-9]{8}\z/
|
||||||
errors.add(:ident, :invalid_EE_identity_format)
|
errors.add(:ident, :invalid_EE_identity_format)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue