FIX: Use a cookie to bypass the anon cache

This commit is contained in:
Robin Ward 2015-10-28 17:16:56 -04:00
parent db5379508e
commit a9823ab59a
2 changed files with 7 additions and 1 deletions

View file

@ -57,6 +57,7 @@ class Users::OmniauthCallbacksController < ApplicationController
complete_response_data
if provider && provider.full_screen_login
cookies['_bypass_cache'] = true
flash[:authentication_data] = @auth_result.to_client_hash.to_json
redirect_to @origin
else

View file

@ -64,8 +64,13 @@ module Middleware
CurrentUser.has_auth_cookie?(@env)
end
def no_cache_bypass
request = Rack::Request.new(@env)
request.cookies['_bypass_cache'].nil?
end
def cacheable?
!!(!has_auth_cookie? && get?)
!!(!has_auth_cookie? && get? && no_cache_bypass)
end
def cached