mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 09:43:36 +02:00
parent
4254fa0c94
commit
326ded8010
2 changed files with 10 additions and 7 deletions
|
@ -1,6 +1,10 @@
|
||||||
module Concerns::Contact::Transferable
|
module Concerns::Contact::Transferable
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
included do
|
||||||
|
after_initialize :generate_auth_info, if: :new_record?
|
||||||
|
end
|
||||||
|
|
||||||
def transfer(new_registrar)
|
def transfer(new_registrar)
|
||||||
new_contact = self.dup
|
new_contact = self.dup
|
||||||
new_contact.registrar = new_registrar
|
new_contact.registrar = new_registrar
|
||||||
|
@ -10,4 +14,10 @@ module Concerns::Contact::Transferable
|
||||||
new_contact.save!
|
new_contact.save!
|
||||||
new_contact
|
new_contact
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def generate_auth_info
|
||||||
|
return if @generate_auth_info_disabled
|
||||||
|
return if auth_info.present?
|
||||||
|
self.auth_info = SecureRandom.hex(11)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -45,7 +45,6 @@ class Contact < ActiveRecord::Base
|
||||||
|
|
||||||
before_validation :to_upcase_country_code
|
before_validation :to_upcase_country_code
|
||||||
before_validation :strip_email
|
before_validation :strip_email
|
||||||
before_create :generate_auth_info
|
|
||||||
before_update :manage_emails
|
before_update :manage_emails
|
||||||
|
|
||||||
composed_of :identifier,
|
composed_of :identifier,
|
||||||
|
@ -314,12 +313,6 @@ class Contact < ActiveRecord::Base
|
||||||
!org?
|
!org?
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_auth_info
|
|
||||||
return if @generate_auth_info_disabled
|
|
||||||
return if auth_info.present?
|
|
||||||
self.auth_info = SecureRandom.hex(11)
|
|
||||||
end
|
|
||||||
|
|
||||||
# def auth_info=(pw)
|
# def auth_info=(pw)
|
||||||
# self[:auth_info] = pw if new_record?
|
# self[:auth_info] = pw if new_record?
|
||||||
# end
|
# end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue