Commit c845347b authored by Robert Speicher's avatar Robert Speicher

Generate 10 2FA backup codes instead of the default of 5

parent 5f43cae6
...@@ -81,7 +81,7 @@ class User < ActiveRecord::Base ...@@ -81,7 +81,7 @@ class User < ActiveRecord::Base
devise :two_factor_authenticatable, devise :two_factor_authenticatable,
otp_secret_encryption_key: File.read(Rails.root.join('.secret')).chomp otp_secret_encryption_key: File.read(Rails.root.join('.secret')).chomp
devise :two_factor_backupable devise :two_factor_backupable, otp_number_of_backup_codes: 10
serialize :otp_backup_codes, JSON serialize :otp_backup_codes, JSON
devise :lockable, :async, :recoverable, :rememberable, :trackable, devise :lockable, :async, :recoverable, :rememberable, :trackable,
......
...@@ -39,7 +39,7 @@ feature 'Login' do ...@@ -39,7 +39,7 @@ feature 'Login' do
let(:codes) { user.generate_otp_backup_codes! } let(:codes) { user.generate_otp_backup_codes! }
before do before do
expect(codes.size).to eq 5 expect(codes.size).to eq 10
# Ensure the generated codes get saved # Ensure the generated codes get saved
user.save user.save
...@@ -63,7 +63,7 @@ feature 'Login' do ...@@ -63,7 +63,7 @@ feature 'Login' do
expect(user.invalidate_otp_backup_code!(code)).to eq true expect(user.invalidate_otp_backup_code!(code)).to eq true
user.save! user.save!
expect(user.reload.otp_backup_codes.size).to eq 4 expect(user.reload.otp_backup_codes.size).to eq 9
enter_code(code) enter_code(code)
expect(page).to have_content('Invalid two-factor code') expect(page).to have_content('Invalid two-factor code')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment