Sha256: eb2437dc4ad706734f22022df0c56c5ce88ade58c2417795b0602759d6de6761
Contents?: true
Size: 870 Bytes
Versions: 1
Compression:
Stored size: 870 Bytes
Contents
Warden::Manager.after_authentication do |user, auth, options| if auth.env["action_dispatch.cookies"] expected_cookie_value = "#{user.class}-#{user.public_send(Devise.second_factor_resource_id)}" actual_cookie_value = auth.env["action_dispatch.cookies"].signed[DeviseTwoFactorAuthentication::REMEMBER_TFA_COOKIE_NAME] bypass_by_cookie = actual_cookie_value == expected_cookie_value end if user.respond_to?(:need_two_factor_authentication?) && !bypass_by_cookie if auth.session(options[:scope])[DeviseTwoFactorAuthentication::NEED_AUTHENTICATION] = user.need_two_factor_authentication?(auth.request) user.send_new_otp if user.send_new_otp_after_login? end end end Warden::Manager.before_logout do |user, auth, _options| auth.cookies.delete DeviseTwoFactorAuthentication::REMEMBER_TFA_COOKIE_NAME if Devise.delete_cookie_on_logout end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
devise_two_factor_authentication-3.0.0 | lib/devise_two_factor_authentication/hooks/two_factor_authenticatable.rb |