Skip to content

Commit

Permalink
Merge pull request #240 from inkstak/bugfix-insert_two_factor_authent…
Browse files Browse the repository at this point in the history
…icatable_on_top

:two_factor_authenticatable should be inserted on top
  • Loading branch information
bsedat committed Aug 22, 2023
2 parents d486aed + 61ca1a0 commit 99c9b35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/devise-two-factor.rb
Expand Up @@ -31,7 +31,7 @@ module Devise
end

Devise.add_module(:two_factor_authenticatable, :route => :session, :strategy => true,
:controller => :sessions, :model => true)
:controller => :sessions, :model => true, :insert_at => 0)

Devise.add_module(:two_factor_backupable, :route => :session, :strategy => true,
:controller => :sessions, :model => true)
4 changes: 4 additions & 0 deletions spec/devise/models/two_factor_authenticatable_spec.rb
Expand Up @@ -25,6 +25,10 @@ def save(validate)
end

describe ::Devise::Models::TwoFactorAuthenticatable do
it 'should be inserted prior to other devise modules' do
expect(Devise::ALL.first).to eq(:two_factor_authenticatable)
end

context 'When included in a class' do
subject { TwoFactorAuthenticatableDouble.new }

Expand Down

0 comments on commit 99c9b35

Please sign in to comment.