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

This commit is contained in:
Martin Lensment 2015-06-09 17:52:06 +03:00
commit ffb1ab6521
8 changed files with 24 additions and 18 deletions

View file

@ -57,6 +57,7 @@ class Admin::AdminUsersController < AdminController
end
def admin_user_params
params.require(:admin_user).permit(:username, :password, :password_confirmation, :identity_code, :email, :country_code, { roles: [] })
params.require(:admin_user).permit(:username,
:password, :password_confirmation, :identity_code, :email, :country_code, { roles: [] })
end
end

View file

@ -70,7 +70,7 @@ class Domain < ActiveRecord::Base
after_save :update_whois_record
validates :name_dirty, domain_name: true, uniqueness: true
validates :name_puny, length: { maximum: 66 }
validates :puny_label, length: { maximum: 63 }
validates :period, numericality: { only_integer: true }
validates :registrant, :registrar, presence: true
@ -166,6 +166,10 @@ class Domain < ActiveRecord::Base
"EIS-#{id}"
end
def puny_label
name_puny.to_s.split('.').first
end
def registrant_typeahead
@registrant_typeahead || registrant.try(:name) || nil
end

View file

@ -55,7 +55,7 @@ class Epp::Domain < Domain
],
'2005' => [ # Parameter value syntax error
[:name_dirty, :invalid, { obj: 'name', val: name_dirty }],
[:name_puny, :too_long, { obj: 'name', val: name_puny }]
[:puny_label, :too_long, { obj: 'name', val: name_puny }]
],
'2201' => [ # Authorisation error
[:auth_info, :wrong_pw]

View file

@ -1,11 +1,4 @@
class DomainNameValidator < ActiveModel::EachValidator
# TODO
# validates lenght of 2-63
# validates/honours Estonian additional letters zäõüö
# honours punicode and all interfces honors utf8
# validates lower level domains (.pri.ee, edu.ee etc)
# lower level domains are fixed for .ee and can add statically into settings
def validate_each(record, attribute, value)
if !self.class.validate_format(value)
record.errors[attribute] << (options[:message] || record.errors.generate_message(attribute, :invalid))