File: devise-two-factor.rb

package info (click to toggle)
ruby-devise-two-factor 4.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 264 kB
  • sloc: ruby: 528; makefile: 3
file content (33 lines) | stat: -rw-r--r-- 1,091 bytes parent folder | download | duplicates (3)
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)