Add verification model & migration

This commit is contained in:
Alex Sherman 2020-06-05 16:41:56 +05:00
parent b8ade7628d
commit cc142076c3
4 changed files with 168 additions and 7 deletions

View file

@ -2,6 +2,18 @@ module Concerns
module EmailCheckable
extend ActiveSupport::Concern
def email_verification
EmailAddressVerification.find_by(email: self.email)
end
def billing_email_verification
if self.attribute_names.include?('billing_email')
EmailAddressVerification.find_by(email: self.billing_email)
else
nil
end
end
def verify_email_mx_smtp(field:, email:)
errors.add(field, :invalid) unless email.blank? || Truemail.valid?(email)
end

View file

@ -0,0 +1,4 @@
class EmailAddressVerification < ApplicationRecord
end