Sha256: e662d7e4513860b82dfef26f9f9072bb0b9c1f4536a4e86e8211fe1a4898d72f

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

require 'devise_instant2fa/version'
require 'devise'
require 'active_support/concern'
require 'active_support/core_ext/class/attribute_accessors'
require 'instant2fa'

module Devise

  @@instant2fa_access_key = nil
  def self.instant2fa_access_key
    @@instant2fa_access_key
  end

  def self.instant2fa_access_key=(instant2fa_access_key)
    @@instant2fa_access_key = @@instant2fa_access_key
    Instant2fa.configure do |config|
      config.access_key = instant2fa_access_key
    end
  end

  @@instant2fa_access_secret = nil
  def self.instant2fa_access_secret
    @@instant2fa_access_secret
  end

  def self.instant2fa_access_secret=(instant2fa_access_secret)
    @@instant2fa_access_secret = @@instant2fa_access_secret
    Instant2fa.configure do |config|
      config.access_secret = instant2fa_access_secret
    end
  end
end

module DeviseInstant2fa
  NEED_AUTHENTICATION = 'need_two_factor_authentication'
  HOSTED_PAGE_URL = 'hosted_page_url'

  module Controllers
    autoload :Helpers, 'devise_instant2fa/controllers/helpers'
  end

  module Views
    autoload :Helpers, 'devise_instant2fa/views/helpers'
  end
end

module Devise
  module Models
    module Instant2faAuthenticatable
      def instant2fa_settings_url
        Instant2fa.create_settings(self.id)
      end
    end
  end
end

Devise.add_module :instant2fa_authenticatable, :controller => :instant2fa, :route => :instant2fa

require 'devise_instant2fa/hooks/instant2fa_authenticatable'
require 'devise_instant2fa/routes'
require 'devise_instant2fa/rails'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
devise_instant2fa-1.0.1 lib/devise_instant2fa.rb
devise_instant2fa-1.0.0 lib/devise_instant2fa.rb