mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 19:20:37 +02:00
Sync password between reserved/disputed
This commit is contained in:
parent
56a351f0cb
commit
ffa529c97b
1 changed files with 6 additions and 0 deletions
|
@ -2,6 +2,7 @@ class ReservedDomain < ApplicationRecord
|
|||
include Versions # version/reserved_domain_version.rb
|
||||
before_save :fill_empty_passwords
|
||||
before_save :generate_data
|
||||
before_save :sync_dispute_password
|
||||
after_destroy :remove_data
|
||||
|
||||
validates :name, domain_name: true, uniqueness: true
|
||||
|
@ -41,6 +42,11 @@ class ReservedDomain < ApplicationRecord
|
|||
self.password = SecureRandom.hex
|
||||
end
|
||||
|
||||
def sync_dispute_password
|
||||
dispute = Dispute.active.find_by(domain_name: domain_name)
|
||||
self.password = dispute.password if dispute.present?
|
||||
end
|
||||
|
||||
def generate_data
|
||||
return if Domain.where(name: name).any?
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue