DEV: s/\$redis/Discourse\.redis (#8431)

This commit also adds a rubocop rule to prevent global variables.
This commit is contained in:
Joffrey JAFFEUX
2019-12-03 10:05:53 +01:00
committed by GitHub
parent 9eccfb7b52
commit 0d3d2c43a0
118 changed files with 378 additions and 362 deletions

View File

@ -30,7 +30,7 @@ class Auth::DefaultCurrentUserProvider
# bypass if we have the shared session header
if shared_key = @env['HTTP_X_SHARED_SESSION_KEY']
uid = $redis.get("shared_session_key_#{shared_key}")
uid = Discourse.redis.get("shared_session_key_#{shared_key}")
user = nil
if uid
user = User.find_by(id: uid.to_i)

View File

@ -87,7 +87,7 @@ class Auth::OpenIdAuthenticator < Auth::Authenticator
omniauth.provider :open_id,
setup: lambda { |env|
strategy = env["omniauth.strategy"]
strategy.options[:store] = OpenID::Store::Redis.new($redis)
strategy.options[:store] = OpenID::Store::Redis.new(Discourse.redis)
# Add CSRF protection in addition to OpenID Specification
def strategy.query_string