Adds some methods to to Verification module
This commit is contained in:
@@ -1,4 +1,12 @@
|
|||||||
module Verification
|
module Verification
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
included do
|
||||||
|
scope :level_three_verified, -> { where.not(verified_at: nil) }
|
||||||
|
scope :level_two_verified, -> { where("users.confirmed_phone IS NOT NULL AND users.residence_verified_at IS NOT NULL") }
|
||||||
|
scope :level_two_or_three_verified, -> { where("users.verified_at IS NOT NULL OR (users.confirmed_phone IS NOT NULL AND users.residence_verified_at IS NOT NULL)") }
|
||||||
|
scope :unverified, -> { where("users.verified_at IS NULL AND (users.confirmed_phone IS NULL OR users.residence_verified_at IS NOT NULL)") }
|
||||||
|
end
|
||||||
|
|
||||||
def verification_email_sent?
|
def verification_email_sent?
|
||||||
email_verification_token.present?
|
email_verification_token.present?
|
||||||
@@ -28,9 +36,13 @@ module Verification
|
|||||||
verified_at.present?
|
verified_at.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def level_two_or_three_verified?
|
||||||
|
level_two_verified? || level_three_verified?
|
||||||
|
end
|
||||||
|
|
||||||
def unverified?
|
def unverified?
|
||||||
!level_two_verified? && !level_three_verified?
|
!level_two_verified? && !level_three_verified?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user