مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-12-01 05:43:04 +00:00
23 أسطر
498 B
Ruby
23 أسطر
498 B
Ruby
require 'resolv'
|
|
|
|
class Domain
|
|
|
|
def dns_verification_string
|
|
"#{Postal.config.dns.domain_verify_prefix} #{verification_token}"
|
|
end
|
|
|
|
def verify_with_dns
|
|
return false unless self.verification_method == 'DNS'
|
|
result = resolver.getresources(self.name, Resolv::DNS::Resource::IN::TXT)
|
|
if result.map { |d| d.data.to_s.strip}.include?(self.dns_verification_string)
|
|
self.verified_at = Time.now
|
|
self.save
|
|
else
|
|
false
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
# -*- SkipSchemaAnnotations
|