mirror of
https://github.com/internetee/registry.git
synced 2025-05-29 17:10:08 +02:00
Refactor
This commit is contained in:
parent
b6ce705748
commit
0c3105a159
1 changed files with 12 additions and 12 deletions
|
@ -211,18 +211,13 @@ class Domain < ActiveRecord::Base
|
||||||
|
|
||||||
def transfer(params)
|
def transfer(params)
|
||||||
return false unless authenticate(params[:pw])
|
return false unless authenticate(params[:pw])
|
||||||
|
|
||||||
pt = pending_transfer
|
pt = pending_transfer
|
||||||
|
|
||||||
if pt && params[:action] == 'approve'
|
if pt && params[:action] == 'approve'
|
||||||
if params[:current_user].registrar != pt.transfer_from
|
return approve_pending_transfer(params[:current_user])
|
||||||
add_epp_error('2304', nil, nil, I18n.t('transfer_can_be_approved_only_by_current_registrar'))
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
approve_pending_transfer and return true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return true if pending_transfer
|
return true if pt
|
||||||
|
|
||||||
wait_time = SettingGroup.domain_general.setting(:transfer_wait_time).value.to_i
|
wait_time = SettingGroup.domain_general.setting(:transfer_wait_time).value.to_i
|
||||||
|
|
||||||
|
@ -249,16 +244,21 @@ class Domain < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def approve_pending_transfer
|
def approve_pending_transfer(current_user)
|
||||||
p = pending_transfer
|
pt = pending_transfer
|
||||||
p.update(
|
if current_user.registrar != pt.transfer_from
|
||||||
|
add_epp_error('2304', nil, nil, I18n.t('transfer_can_be_approved_only_by_current_registrar'))
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
pt.update(
|
||||||
status: DomainTransfer::CLIENT_APPROVED,
|
status: DomainTransfer::CLIENT_APPROVED,
|
||||||
transferred_at: Time.zone.now
|
transferred_at: Time.zone.now
|
||||||
)
|
)
|
||||||
|
|
||||||
generate_auth_info
|
generate_auth_info
|
||||||
|
|
||||||
self.registrar = p.transfer_to
|
self.registrar = pt.transfer_to
|
||||||
save
|
save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue