Merge branch 'master' of github.com:domify/registry

This commit is contained in:
Priit Tark 2015-07-13 11:13:44 +03:00
commit b0296bd33e
10 changed files with 1814 additions and 878 deletions

View file

@ -138,7 +138,7 @@ class EppController < ApplicationController
# validate legal document's type here because it may be in most of the requests
@prefix = nil
if element_count('extdata > legalDocument') > 0
requires_attribute('extdata > legalDocument', 'type', values: LegalDocument::TYPES)
requires_attribute('extdata > legalDocument', 'type', values: LegalDocument::TYPES, policy: true)
end
handle_errors and return if epp_errors.any?
@ -188,12 +188,27 @@ class EppController < ApplicationController
attribute = element[attribute_selector]
return if attribute && options[:values].include?(attribute)
unless attribute
epp_errors << {
code: '2003',
msg: I18n.t('errors.messages.required_parameter_missing', key: attribute_selector)
}
return
end
epp_errors << {
code: '2306',
msg: I18n.t('attribute_is_invalid', attribute: attribute_selector)
}
return if options[:values].include?(attribute)
if options[:policy]
epp_errors << {
code: '2306',
msg: I18n.t('attribute_is_invalid', attribute: attribute_selector)
}
else
epp_errors << {
code: '2004',
msg: I18n.t('parameter_value_range_error', key: attribute_selector)
}
end
end
def optional_attribute(element_selector, attribute_selector, options)

View file

@ -1,4 +1,4 @@
= form_for([:admin, @admin_user], html: { class: 'form-horizontal' }) do |f|
= form_for([:admin, @admin_user], html: { class: 'form-horizontal', autocomplete: 'off' }) do |f|
= render 'shared/full_errors', object: @admin_user
.row
@ -14,12 +14,12 @@
- not_required = @admin_user.new_record? ? '' : 'not-required'
= f.label :password, class: not_required
.col-md-8
= f.password_field(:password, class: 'form-control')
= f.text_field(:password, class: 'form-control')
.form-group
.col-md-4.control-label
= f.label :password_confirmation, class: not_required
.col-md-8
= f.password_field(:password_confirmation, class: 'form-control')
= f.text_field(:password_confirmation, class: 'form-control')
%hr
.form-group
@ -36,7 +36,7 @@
.col-md-4.control-label
= f.label :country_code, t(:country)
.col-md-8
= f.select(:country_code,
= f.select(:country_code,
SortedCountry.all_options(f.object.country_code), {}, class: 'form-control')
%hr
.form-group
@ -48,7 +48,7 @@
%hr
.row
.col-md-8.text-right
= button_tag(t(:save), class: 'btn btn-primary')
= button_tag(t(:save), class: 'btn btn-warning')
:coffee
$("#admin_user_password").removeAttr('required')