Do not overwrite auth info on domain create #2833

This commit is contained in:
Martin Lensment 2015-08-13 11:42:54 +03:00
parent a447c8653c
commit eff8dd5d7a
3 changed files with 8 additions and 5 deletions

View file

@ -528,8 +528,13 @@ class Domain < ActiveRecord::Base
Registrant.find_by(id: pending_json['domain']['registrant_id'].last)
end
# rubocop:disable Lint/Loop
def generate_auth_info
return if auth_info.present?
generate_auth_info!
end
# rubocop:disable Lint/Loop
def generate_auth_info!
begin
self.auth_info = SecureRandom.hex
end while self.class.exists?(auth_info: auth_info)

View file

@ -616,7 +616,7 @@ class Epp::Domain < Domain
if dt.approved?
transfer_contacts(current_user.registrar_id)
dt.notify_losing_registrar(old_contact_codes, old_registrant_code)
generate_auth_info
generate_auth_info!
self.registrar = current_user.registrar
end

View file

@ -353,9 +353,7 @@ module Epp
defaults = {
name: { value: next_domain_name },
period: nil,
authInfo: {
pw: { value: '98oiewslkfkd', attrs: { roid: 'citizen_1234-REP' } }
}
authInfo: nil
}
xml_params = defaults.deep_merge(xml_params)