mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 09:45:11 +02:00
Story#113066359 - extract reserved domains regen password from domain to reserved domain
This commit is contained in:
parent
77da9ccd2b
commit
78ffe33dfa
2 changed files with 18 additions and 8 deletions
|
@ -22,17 +22,30 @@ class ReservedDomain < ActiveRecord::Base
|
|||
def any_of_domains names
|
||||
where(name: names)
|
||||
end
|
||||
|
||||
def new_password_for name
|
||||
record = by_domain(name).first
|
||||
return unless record
|
||||
|
||||
record.regenerate_password
|
||||
record.save
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def fill_empty_passwords
|
||||
self.password = SecureRandom.hex if self.password.blank?
|
||||
end
|
||||
|
||||
def name= val
|
||||
super SimpleIDN.to_unicode(val)
|
||||
end
|
||||
|
||||
def fill_empty_passwords
|
||||
regenerate_password if self.password.blank?
|
||||
end
|
||||
|
||||
def regenerate_password
|
||||
self.password = SecureRandom.hex
|
||||
end
|
||||
|
||||
def generate_data
|
||||
return if Domain.where(name: name).any?
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue