mirror of
https://github.com/discourse/discourse.git
synced 2025-03-29 08:49:25 +08:00
FIX: Use a cookie to bypass the anon cache
This commit is contained in:
parent
db5379508e
commit
a9823ab59a
@ -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…
x
Reference in New Issue
Block a user