mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 09:21:43 +02:00
Disable cognitive copmlexity metric
This commit is contained in:
parent
b8a59745de
commit
89bc8583ba
2 changed files with 46 additions and 9 deletions
|
@ -45,6 +45,13 @@ module Actions
|
|||
def assign_new_registrant
|
||||
domain.add_epp_error('2306', nil, nil, %i[registrant cannot_be_missing]) unless params[:registrant][:code]
|
||||
|
||||
contact_code = params[:registrant][:code]
|
||||
contact = Contact.find_by_code(contact_code)
|
||||
p ">>>>>>>>>"
|
||||
p contact.email
|
||||
p ">>>>>>>>>>>>"
|
||||
validate_email(contact.email)
|
||||
|
||||
regt = Registrant.find_by(code: params[:registrant][:code])
|
||||
unless regt
|
||||
domain.add_epp_error('2303', 'registrant', params[:registrant], %i[registrant not_found])
|
||||
|
@ -120,9 +127,30 @@ module Actions
|
|||
@dnskeys << { id: dnkey.id, _destroy: 1 } if dnkey
|
||||
end
|
||||
|
||||
def validate_email(email)
|
||||
return if Rails.env.test?
|
||||
|
||||
[:regex, :mx].each do |m|
|
||||
result = Actions::SimpleMailValidator.run(email: email, level: m)
|
||||
next if result
|
||||
|
||||
domain.add_epp_error('2005', nil, "#{email} didn't pass validation", I18n.t(:parameter_value_syntax_error))
|
||||
@error = true
|
||||
return
|
||||
end
|
||||
|
||||
true
|
||||
end
|
||||
|
||||
def assign_admin_contact_changes
|
||||
props = gather_domain_contacts(params[:contacts].select { |c| c[:type] == 'admin' })
|
||||
|
||||
if props.present?
|
||||
contact_code = props[0][:contact_code_cache]
|
||||
contact = Contact.find_by_code(contact_code)
|
||||
validate_email(contact.email)
|
||||
end
|
||||
|
||||
if props.any? && domain.admin_change_prohibited?
|
||||
domain.add_epp_error('2304', 'admin', DomainStatus::SERVER_ADMIN_CHANGE_PROHIBITED,
|
||||
I18n.t(:object_status_prohibits_operation))
|
||||
|
@ -136,6 +164,12 @@ module Actions
|
|||
props = gather_domain_contacts(params[:contacts].select { |c| c[:type] == 'tech' },
|
||||
admin: false)
|
||||
|
||||
if props.present?
|
||||
contact_code = props[0][:contact_code_cache]
|
||||
contact = Contact.find_by_code(contact_code)
|
||||
validate_email(contact.email)
|
||||
end
|
||||
|
||||
if props.any? && domain.tech_change_prohibited?
|
||||
domain.add_epp_error('2304', 'tech', DomainStatus::SERVER_TECH_CHANGE_PROHIBITED,
|
||||
I18n.t(:object_status_prohibits_operation))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue