DEV: Clean up plugin.rb (#36)
- Remove Faraday version check - all versions of Discourse now have Faraday 1.0 - Remove custom button CSS. Core now takes care of styling login buttons - Remove deprecated `message` parameter from auth_provider registration
This commit is contained in:
parent
aaf3044043
commit
59c3d9aa5e
45
plugin.rb
45
plugin.rb
|
@ -46,30 +46,28 @@ class ::OmniAuth::Strategies::Oauth2Basic < ::OmniAuth::Strategies::OAuth2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if Gem::Version.new(Faraday::VERSION) > Gem::Version.new('1.0')
|
require 'faraday/logging/formatter'
|
||||||
require 'faraday/logging/formatter'
|
class OAuth2FaradayFormatter < Faraday::Logging::Formatter
|
||||||
class OAuth2FaradayFormatter < Faraday::Logging::Formatter
|
def request(env)
|
||||||
def request(env)
|
warn <<~LOG
|
||||||
warn <<~LOG
|
OAuth2 Debugging: request #{env.method.upcase} #{env.url.to_s}
|
||||||
OAuth2 Debugging: request #{env.method.upcase} #{env.url.to_s}
|
|
||||||
|
|
||||||
Headers: #{env.request_headers}
|
Headers: #{env.request_headers}
|
||||||
|
|
||||||
Body: #{env[:body]}
|
Body: #{env[:body]}
|
||||||
LOG
|
LOG
|
||||||
end
|
end
|
||||||
|
|
||||||
def response(env)
|
def response(env)
|
||||||
warn <<~LOG
|
warn <<~LOG
|
||||||
OAuth2 Debugging: response status #{env.status}
|
OAuth2 Debugging: response status #{env.status}
|
||||||
|
|
||||||
From #{env.method.upcase} #{env.url.to_s}
|
From #{env.method.upcase} #{env.url.to_s}
|
||||||
|
|
||||||
Headers: #{env.response_headers}
|
Headers: #{env.response_headers}
|
||||||
|
|
||||||
Body: #{env[:body]}
|
Body: #{env[:body]}
|
||||||
LOG
|
LOG
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -275,15 +273,6 @@ class ::OAuth2BasicAuthenticator < Auth::ManagedAuthenticator
|
||||||
end
|
end
|
||||||
|
|
||||||
auth_provider title_setting: "oauth2_button_title",
|
auth_provider title_setting: "oauth2_button_title",
|
||||||
authenticator: OAuth2BasicAuthenticator.new,
|
authenticator: OAuth2BasicAuthenticator.new
|
||||||
message: "OAuth2"
|
|
||||||
|
|
||||||
register_css <<CSS
|
|
||||||
|
|
||||||
button.btn-social.oauth2_basic {
|
|
||||||
background-color: #6d6d6d;
|
|
||||||
}
|
|
||||||
|
|
||||||
CSS
|
|
||||||
|
|
||||||
load File.expand_path("../lib/validators/oauth2_basic/oauth2_fetch_user_details_validator.rb", __FILE__)
|
load File.expand_path("../lib/validators/oauth2_basic/oauth2_fetch_user_details_validator.rb", __FILE__)
|
||||||
|
|
Loading…
Reference in New Issue