mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-03 19:24:48 +08:00
Fix LinkedIn sign-up [SCI-4047]
This commit is contained in:
parent
91b4c54c58
commit
ab691efdb2
3 changed files with 8 additions and 12 deletions
|
@ -41,13 +41,17 @@ module Users
|
|||
redirect_to after_omniauth_failure_path_for(resource_name)
|
||||
else
|
||||
# Create new user and identity; and redirect to complete sign up form
|
||||
full_name = "#{auth_hash['info']['first_name']} #{auth_hash['info']['last_name']}"
|
||||
@user = User.new(
|
||||
full_name: auth_hash['info']['name'],
|
||||
initials: generate_initials(auth_hash['info']['name']),
|
||||
full_name: full_name,
|
||||
initials: generate_initials(full_name),
|
||||
email: auth_hash['info']['email'],
|
||||
password: generate_user_password
|
||||
)
|
||||
@user.avatar_remote_url = (auth_hash['info']['image'])
|
||||
if auth_hash['info']['picture_url']
|
||||
avatar = URI.open(auth_hash['info']['picture_url'])
|
||||
@user.avatar.attach(io: avatar, filename: 'linkedin_avatar.jpg')
|
||||
end
|
||||
user_identity = UserIdentity.new(user: @user,
|
||||
provider: auth_hash['provider'],
|
||||
uid: auth_hash['uid'])
|
||||
|
|
|
@ -288,8 +288,7 @@ Devise.setup do |config|
|
|||
# up on your models and hooks.
|
||||
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
||||
if Rails.configuration.x.enable_user_registration
|
||||
config.omniauth :linkedin, ENV['LINKEDIN_KEY'], ENV['LINKEDIN_SECRET'],
|
||||
scope: %w(r_basicprofile r_emailaddress)
|
||||
config.omniauth :linkedin, ENV['LINKEDIN_KEY'], ENV['LINKEDIN_SECRET'], scope: 'r_liteprofile r_emailaddress'
|
||||
end
|
||||
|
||||
# ==> Warden configuration
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
require 'omniauth-linkedin-oauth2'
|
||||
|
||||
if Rails.configuration.x.enable_user_registration
|
||||
Rails.application.config.middleware.use OmniAuth::Builder do
|
||||
provider :linkedin, ENV['LINKEDIN_KEY'], ENV['LINKEDIN_SECRET']
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue