forked from External/greenlight
fixing rubocop errors
This commit is contained in:
parent
407e8ee13c
commit
91644281c4
|
@ -33,11 +33,12 @@ module SessionsHelper
|
|||
provider.first == 'www' ? provider.second : provider.first
|
||||
end
|
||||
|
||||
def set_omniauth_options(env)
|
||||
def omniauth_options(env)
|
||||
gl_redirect_url = env["rack.url_scheme"] + "://" + env["SERVER_NAME"] + ":" + env["SERVER_PORT"]
|
||||
env['omniauth.strategy'].options[:customer] = parse_customer_name env["SERVER_NAME"]
|
||||
env['omniauth.strategy'].options[:gl_redirect_url] = gl_redirect_url
|
||||
env['omniauth.strategy'].options[:default_callback_url] = Rails.configuration.gl_callback_url
|
||||
env['omniauth.strategy'].options[:checksum] = generate_checksum parse_customer_name(env["SERVER_NAME"]), gl_redirect_url, Rails.configuration.launcher_secret
|
||||
env['omniauth.strategy'].options[:checksum] = generate_checksum parse_customer_name(env["SERVER_NAME"]),
|
||||
gl_redirect_url, Rails.configuration.launcher_secret
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,8 +22,8 @@ class User < ApplicationRecord
|
|||
class << self
|
||||
# Generates a user from omniauth.
|
||||
def from_omniauth(auth)
|
||||
#Provider is the customer name if in loadbalanced config mode
|
||||
provider = (auth['provider'] == "bn_launcher") ? auth['info']['customer'] : auth['provider']
|
||||
# Provider is the customer name if in loadbalanced config mode
|
||||
provider = auth['provider'] == "bn_launcher" ? auth['info']['customer'] : auth['provider']
|
||||
find_or_initialize_by(social_uid: auth['uid'], provider: provider).tap do |u|
|
||||
u.name = send("#{auth['provider']}_name", auth) unless u.name
|
||||
u.username = send("#{auth['provider']}_username", auth) unless u.username
|
||||
|
|
|
@ -51,4 +51,4 @@ module Greenlight
|
|||
# Configure custom banner message.
|
||||
config.banner_message = ENV['BANNER_MESSAGE']
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -73,7 +73,8 @@ Rails.application.configure do
|
|||
# Use default logging formatter so that PID and timestamp are not suppressed.
|
||||
config.log_formatter = ::Logger::Formatter.new
|
||||
|
||||
# rails runs over http in production. Turning OpenSSL verify off to skip oauth2 verification of certs. This is done on nginx level
|
||||
# rails runs over http in production. Turning OpenSSL verify off to skip oauth2 verification of certs.
|
||||
# This is done on nginx level
|
||||
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
|
||||
|
||||
# Use a different logger for distributed setups.
|
||||
|
|
|
@ -9,18 +9,16 @@ Rails.application.config.omniauth_twitter = ENV['TWITTER_ID'].present? && ENV['T
|
|||
Rails.application.config.omniauth_bn_launcher = Rails.configuration.loadbalanced_configuration
|
||||
|
||||
SETUP_PROC = lambda do |env|
|
||||
SessionsController.helpers.set_omniauth_options env
|
||||
SessionsController.helpers.omniauth_options env
|
||||
end
|
||||
|
||||
|
||||
# Setup the Omniauth middleware.
|
||||
Rails.application.config.middleware.use OmniAuth::Builder do
|
||||
if Rails.configuration.omniauth_bn_launcher
|
||||
provider :bn_launcher,
|
||||
client_id: ENV['CLIENT_ID'],
|
||||
provider :bn_launcher, client_id: ENV['CLIENT_ID'],
|
||||
client_secret: ENV['CLIENT_SECRET'],
|
||||
client_options: {site: ENV['BN_LAUNCHER_REDIRECT_URI']},
|
||||
:setup => SETUP_PROC
|
||||
client_options: { site: ENV['BN_LAUNCHER_REDIRECT_URI'] },
|
||||
setup: SETUP_PROC
|
||||
end
|
||||
|
||||
provider :twitter, ENV['TWITTER_ID'], ENV['TWITTER_SECRET']
|
||||
|
|
Loading…
Reference in New Issue