1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
require 'devise'
require 'devise_two_factor/models'
require 'devise_two_factor/strategies'
module Devise
# The length of generated OTP secrets
mattr_accessor :otp_secret_length
@@otp_secret_length = 24
# The number of seconds before and after the current
# time for which codes will be accepted
mattr_accessor :otp_allowed_drift
@@otp_allowed_drift = 30
# The key used to encrypt OTP secrets in the database
mattr_accessor :otp_secret_encryption_key
@@otp_secret_encryption_key = nil
# The length of all generated OTP backup codes
mattr_accessor :otp_backup_code_length
@@otp_backup_code_length = 16
# The number of backup codes generated by a call to
# generate_otp_backup_codes!
mattr_accessor :otp_number_of_backup_codes
@@otp_number_of_backup_codes = 5
end
Devise.add_module(:two_factor_authenticatable, :route => :session, :strategy => true,
:controller => :sessions, :model => true)
Devise.add_module(:two_factor_backupable, :route => :session, :strategy => true,
:controller => :sessions, :model => true)
|