Show status error in domain update request

This commit is contained in:
Martin Lensment 2014-08-27 12:28:59 +03:00
parent 8697f8eabb
commit 1b4779de0e
3 changed files with 24 additions and 5 deletions

View file

@ -39,11 +39,21 @@ module Epp::DomainsHelper
@domain = find_domain @domain = find_domain
handle_errors(@domain) and return unless @domain handle_errors(@domain) and return unless @domain
handle_errors(@domain) and return unless @domain.parse_and_attach_domain_dependencies(@ph, parsed_frame.css('add'))
handle_errors(@domain) and return unless @domain.parse_and_detach_domain_dependencies(parsed_frame.css('rem')) @domain.parse_and_attach_domain_dependencies(@ph, parsed_frame.css('add'))
handle_errors(@domain) and return unless @domain.parse_and_update_domain_dependencies(parsed_frame.css('chg')) @domain.parse_and_detach_domain_dependencies(parsed_frame.css('rem'))
handle_errors(@domain) and return unless @domain.parse_and_update_domain_attributes(parsed_frame.css('chg')) @domain.parse_and_update_domain_dependencies(parsed_frame.css('chg'))
handle_errors(@domain) and return unless @domain.save @domain.parse_and_update_domain_attributes(parsed_frame.css('chg'))
if @domain.errors.any?
handle_errors(@domain)
raise ActiveRecord::Rollback and return
end
unless @domain.save
handle_errors(@domain)
raise ActiveRecord::Rollback and return
end
render '/epp/domains/success' render '/epp/domains/success'
end end

View file

@ -127,7 +127,15 @@ class Domain < ActiveRecord::Base
def attach_statuses(status_list) def attach_statuses(status_list)
status_list.each do |x| status_list.each do |x|
existing = domain_statuses.select { |o| o.value == x[:value] }
if existing.any?
add_epp_error('2302', 'status', x[:value], [:domain_statuses, :taken])
next
end
setting = SettingGroup.domain_statuses.settings.find_by(value: x[:value]) setting = SettingGroup.domain_statuses.settings.find_by(value: x[:value])
domain_statuses.build( domain_statuses.build(
setting: setting, setting: setting,
description: x[:description] description: x[:description]

View file

@ -61,6 +61,7 @@ en:
wrong_pw: 'Authentication error' wrong_pw: 'Authentication error'
domain_statuses: domain_statuses:
not_found: 'Status was not found' not_found: 'Status was not found'
taken: 'Status already exists on this domain'
nameserver: nameserver:
attributes: attributes:
hostname: hostname: