Browse Source

Merge pull request #100 from msx2/custom-resource-id-field

Fixed sign in via remember 2fa cookie
master
Dmitrii Golub 8 years ago committed by GitHub
parent
commit
ed343cd20a
  1. 2
      lib/two_factor_authentication/hooks/two_factor_authenticatable.rb

2
lib/two_factor_authentication/hooks/two_factor_authenticatable.rb

@ -1,6 +1,6 @@
Warden::Manager.after_authentication do |user, auth, options| Warden::Manager.after_authentication do |user, auth, options|
if auth.env["action_dispatch.cookies"] if auth.env["action_dispatch.cookies"]
expected_cookie_value = "#{user.class}-#{user.public_send(Devise.second_factor_resource_id)}", expected_cookie_value = "#{user.class}-#{user.public_send(Devise.second_factor_resource_id)}"
actual_cookie_value = auth.env["action_dispatch.cookies"].signed[TwoFactorAuthentication::REMEMBER_TFA_COOKIE_NAME] actual_cookie_value = auth.env["action_dispatch.cookies"].signed[TwoFactorAuthentication::REMEMBER_TFA_COOKIE_NAME]
bypass_by_cookie = actual_cookie_value == expected_cookie_value bypass_by_cookie = actual_cookie_value == expected_cookie_value
end end

Loading…
Cancel
Save