Sha256: cd56c59f7b0a0aa2a30676269aa2c96956d7b9879185dc1dd6f1bafc60bb623c

Contents?: true

Size: 579 Bytes

Versions: 4

Compression:

Stored size: 579 Bytes

Contents

# frozen_string_literal
#
# Model concern to provide shared behaviour for two-factor auth (one-time password)
#
# Automatically generated by the orthodox gem (https://github.com/katanacode/orthodox)
# (c) Copyright 2019 Katana Code Ltd. All Rights Reserved. 
module Otpable
  extend ActiveSupport::Concern
  
  included do
    
    has_one :otp_credential, as: :authable  
    
    delegate :valid_otp?, :valid_recovery_code?, to: :otp_credential
    
  end
  
  def tfa?
    otp_credential.present?
  end
    
  def destroy_otp_credential
    otp_credential.destroy
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
orthodox-0.3.3 lib/generators/authentication/templates/models/concerns/otpable.rb
orthodox-0.3.2 lib/generators/authentication/templates/models/concerns/otpable.rb
orthodox-0.3.1 lib/generators/authentication/templates/models/concerns/otpable.rb
orthodox-0.3.0 lib/generators/authentication/templates/models/concerns/otpable.rb