Sha256: 63b1f418ec7f036a3155436d3f3613e6f3b53194cf69868663889d95c217706d

Contents?: true

Size: 1.99 KB

Versions: 6

Compression:

Stored size: 1.99 KB

Contents

module DeviseTwoFactor
  module Generators # :nodoc:
    # Install Generator
    class InstallGenerator < Rails::Generators::Base
      source_root File.expand_path('../../templates', __FILE__)

      desc 'Install the Devise two-factor authentication extension'

      def add_configs
        content = <<-CONTENT

  # ==> Devise TwoFactor Extension
  # Configure OTP extension for devise

  # OTP is mandatory, users are going to be asked to
  # enroll OTP the next time they sign in, before they can successfully complete the session establishment.
  # This is the global value, can also be set on each user.
  #config.otp_mandatory = false

  # Drift: a window which provides allowance for drift between a user's token device clock
  # (and therefore their OTP tokens) and the authentication server's clock.
  # Expressed in minutes centered at the current time. (Note: it's a number, *NOT* 3.minutes )
  #config.otp_drift_window = 3

  # Users that have logged in longer than this time ago, are going to be asked their password
  # (and an OTP challenge, if enabled) before they can see or change their otp informations.
  #config.otp_credentials_refresh = 15.minutes

  # Users are given a list of one-time recovery tokens, for emergency access
  # set to false to disable giving recovery tokens.
  #config.otp_recovery_tokens = 10

  # The user is allowed to set his browser as "trusted", no more OTP challenges will be
  # asked for that browser, for a limited time.
  # set to false to disable setting the browser as trusted
  #config.otp_trust_persistence = 1.month

  # The name of the token issuer, to be added to the provisioning
  # url. Display will vary based on token application. (defaults to the Rails application class)
  #config.otp_issuer = 'my_application'

CONTENT

        inject_into_file 'config/initializers/devise.rb', content, before: /end[ |\n|]+\Z/
      end

      def copy_locale
        copy_file '../../../config/locales/en.yml', 'config/locales/devise.two_factor.en.yml'
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
devise-2fa-0.4.1 lib/generators/devise_two_factor/install_generator.rb
devise-2fa-0.4.0 lib/generators/devise_two_factor/install_generator.rb
devise-2fa-0.2.1 lib/generators/devise_two_factor/install_generator.rb
devise-2fa-0.2.0 lib/generators/devise_two_factor/install_generator.rb
devise-2fa-0.1.1 lib/generators/devise_two_factor/install_generator.rb
devise-2fa-0.1.0 lib/generators/devise_two_factor/install_generator.rb