diff --git a/app/helpers/epp/contacts_helper.rb b/app/helpers/epp/contacts_helper.rb index 9e1a6882b..594ecf2b5 100644 --- a/app/helpers/epp/contacts_helper.rb +++ b/app/helpers/epp/contacts_helper.rb @@ -87,12 +87,12 @@ module Epp::ContactsHelper end def has_rights? - authInfo = @ph.try(:[], :authInfo).try(:[], :pw) || @ph.try(:[], :chg).try(:[], :authInfo).try(:[], :pw) || [] + pw = @ph.try(:[], :authInfo).try(:[], :pw) || @ph.try(:[], :chg).try(:[], :authInfo).try(:[], :pw) || [] id = @ph[:id] - return true if (id && authInfo && !find_contact.nil? && find_contact.auth_info == authInfo) + return true if ( !find_contact.nil? && find_contact.auth_info_matches(pw) ) - epp_errors << { code: '2201', msg: t('errors.messages.epp_authorization_error'), value: { obj: 'pw', val: authInfo } } + epp_errors << { code: '2201', msg: t('errors.messages.epp_authorization_error'), value: { obj: 'pw', val: pw } } return false end diff --git a/app/models/contact.rb b/app/models/contact.rb index 18fb5bf18..92a65f384 100644 --- a/app/models/contact.rb +++ b/app/models/contact.rb @@ -66,6 +66,11 @@ class Contact < ActiveRecord::Base updated_by ? updated_by.username : nil end + def auth_info_matches pw + return true if auth_info == pw + return false + end + class << self def extract_attributes ph, type=:create