mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-02-24 23:44:09 -05:00
FIX: Use a cookie to bypass the anon cache
This commit is contained in:
parent
db5379508e
commit
a9823ab59a
2 changed files with 7 additions and 1 deletions
|
@ -57,6 +57,7 @@ class Users::OmniauthCallbacksController < ApplicationController
|
||||||
complete_response_data
|
complete_response_data
|
||||||
|
|
||||||
if provider && provider.full_screen_login
|
if provider && provider.full_screen_login
|
||||||
|
cookies['_bypass_cache'] = true
|
||||||
flash[:authentication_data] = @auth_result.to_client_hash.to_json
|
flash[:authentication_data] = @auth_result.to_client_hash.to_json
|
||||||
redirect_to @origin
|
redirect_to @origin
|
||||||
else
|
else
|
||||||
|
|
|
@ -64,8 +64,13 @@ module Middleware
|
||||||
CurrentUser.has_auth_cookie?(@env)
|
CurrentUser.has_auth_cookie?(@env)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def no_cache_bypass
|
||||||
|
request = Rack::Request.new(@env)
|
||||||
|
request.cookies['_bypass_cache'].nil?
|
||||||
|
end
|
||||||
|
|
||||||
def cacheable?
|
def cacheable?
|
||||||
!!(!has_auth_cookie? && get?)
|
!!(!has_auth_cookie? && get? && no_cache_bypass)
|
||||||
end
|
end
|
||||||
|
|
||||||
def cached
|
def cached
|
||||||
|
|
Loading…
Reference in a new issue