mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 19:20:37 +02:00
Algorithm validation for dnskey
This commit is contained in:
parent
17e1668794
commit
f776078214
3 changed files with 67 additions and 1 deletions
|
@ -1,3 +1,25 @@
|
|||
class Dnskey < ActiveRecord::Base
|
||||
include EppErrors
|
||||
|
||||
belongs_to :domain
|
||||
|
||||
validate :validate_algorithm
|
||||
|
||||
def epp_code_map
|
||||
{
|
||||
'2005' => [
|
||||
[:alg, :invalid, { value: { obj: 'alg', val: alg } }]
|
||||
],
|
||||
'2306' => [
|
||||
[:ipv4, :blank]
|
||||
]
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
def validate_algorithm
|
||||
return if %w(3 5 6 7 8 252 253 254 255).include?(alg.to_s)
|
||||
errors.add(:alg, :invalid)
|
||||
# , format: {with: /3|5|6/, message: :alg_invalid}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue