mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 04:37:30 +02:00
20 lines
442 B
Ruby
20 lines
442 B
Ruby
class EmailAddressVerification < ApplicationRecord
|
|
|
|
RECENTLY_VERIFIED_PERIOD = 1.month
|
|
|
|
def recently_verified?
|
|
verified_at.present? &&
|
|
verified_at > Time.zone.now - RECENTLY_VERIFIED_PERIOD
|
|
end
|
|
|
|
def verify
|
|
validation_request = Truemail.validate(email)
|
|
|
|
if validation_request.result.success
|
|
update(verified_at: Time.zone.now,
|
|
success: true)
|
|
end
|
|
|
|
validation_request.result.success
|
|
end
|
|
end
|