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