Story#113066359 - extract reserved domains regen password from domain to reserved domain

This commit is contained in:
Vladimir Krylov 2016-02-11 12:17:11 +02:00
parent 77da9ccd2b
commit 78ffe33dfa
2 changed files with 18 additions and 8 deletions

View file

@ -91,10 +91,7 @@ class Domain < ActiveRecord::Base
after_create :update_reserved_domains
def update_reserved_domains
return unless in_reserved_list?
rd = ReservedDomain.by_domain(name).first
rd.password = SecureRandom.hex
rd.save
ReservedDomain.new_password_for(name) if in_reserved_list?
end
validates :name_dirty, domain_name: true, uniqueness: true
@ -370,7 +367,7 @@ class Domain < ActiveRecord::Base
end
def in_reserved_list?
ReservedDomain.pw_for(name).present?
@in_reserved_list ||= ReservedDomain.by_domain(name).any?
end
def pending_transfer