Sha256: fdc820a67e9a6dfd99373e473b51aff39faf01c1f28d38b12ee338e0f0ff8bb4
Contents?: true
Size: 872 Bytes
Versions: 6
Compression:
Stored size: 872 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[DeviseXfactorAuthentication::REMEMBER_TFA_COOKIE_NAME] bypass_by_cookie = actual_cookie_value == expected_cookie_value end if user.respond_to?(:need_devise_xfactor_authentication?) && !bypass_by_cookie if auth.session(options[:scope])[DeviseXfactorAuthentication::NEED_AUTHENTICATION] = user.need_devise_xfactor_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 DeviseXfactorAuthentication::REMEMBER_TFA_COOKIE_NAME if Devise.delete_cookie_on_logout end
Version data entries
6 entries across 6 versions & 1 rubygems