مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-12-01 05:43:04 +00:00
chore: upgrade rails to 7.0 and other dependencies
هذا الالتزام موجود في:
@@ -61,17 +61,7 @@ class Domain < ApplicationRecord
|
||||
|
||||
scope :verified, -> { where.not(verified_at: nil) }
|
||||
|
||||
when_attribute :verification_method, changes_to: :anything do
|
||||
before_save do
|
||||
if verification_method == "DNS"
|
||||
self.verification_token = Nifty::Utils::RandomString.generate(length: 32)
|
||||
elsif verification_method == "Email"
|
||||
self.verification_token = rand(999_999).to_s.ljust(6, "0")
|
||||
else
|
||||
self.verification_token = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
before_save :update_verification_token_on_method_change
|
||||
|
||||
def verified?
|
||||
verified_at.present?
|
||||
@@ -168,4 +158,18 @@ class Domain < ApplicationRecord
|
||||
false
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def update_verification_token_on_method_change
|
||||
return unless verification_method_changed?
|
||||
|
||||
if verification_method == "DNS"
|
||||
self.verification_token = Nifty::Utils::RandomString.generate(length: 32)
|
||||
elsif verification_method == "Email"
|
||||
self.verification_token = rand(999_999).to_s.ljust(6, "0")
|
||||
else
|
||||
self.verification_token = nil
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم