mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
refactor
This commit is contained in:
parent
91f373379a
commit
17f7a609cc
2 changed files with 8 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue