mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 16:32:04 +02:00
update validation of email when domain contacts are updated
This commit is contained in:
parent
c972308f03
commit
58db467229
2 changed files with 21 additions and 12 deletions
|
@ -46,7 +46,7 @@ module Actions
|
|||
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)
|
||||
contact = Contact.find_by(code: contact_code)
|
||||
validate_email(contact.email)
|
||||
|
||||
regt = Registrant.find_by(code: params[:registrant][:code])
|
||||
|
@ -124,6 +124,15 @@ module Actions
|
|||
@dnskeys << { id: dnkey.id, _destroy: 1 } if dnkey
|
||||
end
|
||||
|
||||
def start_validate_email(props)
|
||||
contact_code = props[0][:contact_code_cache]
|
||||
contact = Contact.find_by(code: contact_code)
|
||||
|
||||
return if contact.nil?
|
||||
|
||||
validate_email(contact.email)
|
||||
end
|
||||
|
||||
def validate_email(email)
|
||||
return true if Rails.env.test?
|
||||
|
||||
|
@ -142,11 +151,7 @@ module Actions
|
|||
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
|
||||
start_validate_email(props) if props.present?
|
||||
|
||||
if props.any? && domain.admin_change_prohibited?
|
||||
domain.add_epp_error('2304', 'admin', DomainStatus::SERVER_ADMIN_CHANGE_PROHIBITED,
|
||||
|
@ -161,11 +166,7 @@ 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
|
||||
start_validate_email(props) if props.present?
|
||||
|
||||
if props.any? && domain.tech_change_prohibited?
|
||||
domain.add_epp_error('2304', 'tech', DomainStatus::SERVER_TECH_CHANGE_PROHIBITED,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue