forked from External/greenlight
small fixes
This commit is contained in:
parent
590e189474
commit
0d2a5a4c90
|
@ -1,6 +1,6 @@
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/blindsidenetworks/omniauth-bn-launcher.git
|
remote: https://github.com/blindsidenetworks/omniauth-bn-launcher.git
|
||||||
revision: 6b79f38114a1c9e2dde4958ad5a4f02443c9c023
|
revision: f7bb3dc68c418069b1f432b555ef6b35ced4ef87
|
||||||
specs:
|
specs:
|
||||||
omniauth-bn-launcher (0.1.0)
|
omniauth-bn-launcher (0.1.0)
|
||||||
omniauth (~> 1.3, >= 1.3.2)
|
omniauth (~> 1.3, >= 1.3.2)
|
||||||
|
|
|
@ -22,7 +22,9 @@ class User < ApplicationRecord
|
||||||
class << self
|
class << self
|
||||||
# Generates a user from omniauth.
|
# Generates a user from omniauth.
|
||||||
def from_omniauth(auth)
|
def from_omniauth(auth)
|
||||||
find_or_initialize_by(social_uid: auth['uid'], provider: auth['provider']).tap do |u|
|
#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.name = send("#{auth['provider']}_name", auth) unless u.name
|
||||||
u.username = send("#{auth['provider']}_username", auth) unless u.username
|
u.username = send("#{auth['provider']}_username", auth) unless u.username
|
||||||
u.email = send("#{auth['provider']}_email", auth)
|
u.email = send("#{auth['provider']}_email", auth)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# List of supported Omniauth providers.
|
# List of supported Omniauth providers.
|
||||||
Rails.application.config.providers = [:google, :twitter, :bn_launcher]
|
Rails.application.config.providers = [:google, :twitter]
|
||||||
|
|
||||||
# Set which providers are configured.
|
# Set which providers are configured.
|
||||||
Rails.application.config.omniauth_google = ENV['GOOGLE_OAUTH2_ID'].present? && ENV['GOOGLE_OAUTH2_SECRET'].present?
|
Rails.application.config.omniauth_google = ENV['GOOGLE_OAUTH2_ID'].present? && ENV['GOOGLE_OAUTH2_SECRET'].present?
|
||||||
|
@ -23,11 +23,6 @@ Rails.application.config.middleware.use OmniAuth::Builder do
|
||||||
client_options: {site: ENV['BN_LAUNCHER_REDIRECT_URI']},
|
client_options: {site: ENV['BN_LAUNCHER_REDIRECT_URI']},
|
||||||
:setup => SETUP_PROC
|
:setup => SETUP_PROC
|
||||||
end
|
end
|
||||||
# provider :bn_launcher,
|
|
||||||
# client_id: '123',
|
|
||||||
# client_secret: '456',
|
|
||||||
# client_options: {site: "http://demo.gl.greenlight.com:3000"},
|
|
||||||
# :setup => SETUP_PROC
|
|
||||||
|
|
||||||
provider :twitter, ENV['TWITTER_ID'], ENV['TWITTER_SECRET']
|
provider :twitter, ENV['TWITTER_ID'], ENV['TWITTER_SECRET']
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue