Commit 7b879bb8 authored by Robert Speicher's avatar Robert Speicher

Bump secret key length to 32

parent e73ea126
class Profiles::TwoFactorAuthsController < Profiles::ApplicationController class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
def new def new
unless current_user.otp_secret unless current_user.otp_secret
current_user.otp_secret = User.generate_otp_secret(16) current_user.otp_secret = User.generate_otp_secret(32)
current_user.save! current_user.save!
end end
......
...@@ -12,7 +12,7 @@ describe Profiles::TwoFactorAuthsController do ...@@ -12,7 +12,7 @@ describe Profiles::TwoFactorAuthsController do
let(:user) { create(:user) } let(:user) { create(:user) }
it 'generates otp_secret for user' do it 'generates otp_secret for user' do
expect(User).to receive(:generate_otp_secret).with(16).and_return('secret').once expect(User).to receive(:generate_otp_secret).with(32).and_return('secret').once
get :new get :new
get :new # Second hit shouldn't re-generate it get :new # Second hit shouldn't re-generate it
......
...@@ -31,7 +31,7 @@ FactoryGirl.define do ...@@ -31,7 +31,7 @@ FactoryGirl.define do
trait :two_factor do trait :two_factor do
before(:create) do |user| before(:create) do |user|
user.otp_required_for_login = true user.otp_required_for_login = true
user.otp_secret = User.generate_otp_secret(16) user.otp_secret = User.generate_otp_secret(32)
end end
end end
......
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