From f99b8b66b07cc899a98c9e4ecb78f1c69fb7de95 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 25 Jan 2018 12:40:17 +0200 Subject: [PATCH] Regenerate `auth_info` on contact transfer #660 --- app/models/concerns/contact/transferable.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/concerns/contact/transferable.rb b/app/models/concerns/contact/transferable.rb index 324e18cb2..dab02e6e3 100644 --- a/app/models/concerns/contact/transferable.rb +++ b/app/models/concerns/contact/transferable.rb @@ -10,13 +10,17 @@ module Concerns::Contact::Transferable new_contact.registrar = new_registrar new_contact.generate_code new_contact.original = self + new_contact.regenerate_auth_info new_contact.remove_address unless self.class.address_processing? new_contact.save! new_contact end + protected + def generate_auth_info - return if auth_info.present? self.auth_info = SecureRandom.hex(11) end + + alias_method :regenerate_auth_info, :generate_auth_info end