Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ def serializable_hash(options = nil)

def self.find_or_create_from_auth_hash(auth_hash)
self.find_or_create_by(uid: auth_hash[:uid]) do |user|
user.name = auth_hash[:info][:first_name] + ' ' + auth_hash[:info][:last_name]
user.email = auth_hash[:info][:email]
user.name = auth_hash[:info][:first_name] + ' ' + auth_hash[:info][:last_name] rescue user.name = nil
user.email = auth_hash[:info][:email] rescue user.email = nil
# user.description = auth_hash[:info][:description]
user.location = auth_hash[:info][:location][:name]
user.photo_url = auth_hash.extra.raw_info.pictureUrls.values[1][0] unless auth_hash.extra.raw_info.pictureUrls.values.empty?
user.linkedin_url = auth_hash[:info][:urls][:public_profile]
user.location = auth_hash[:info][:location][:name] rescue user.location = nil
user.photo_url = auth_hash.extra.raw_info.pictureUrls.values[1][0] rescue user.photo_url = nil
user.linkedin_url = auth_hash[:info][:urls][:public_profile] rescue user.linkedin_url = nil
# user.linkedin_token = auth_hash[:credentials][:token]
# user.linkedin_token_expiration = auth_hash[:credentials][:expires_at]
user.current_company = auth_hash[:extra][:raw_info][:positions][:values][0][:company][:name]
user.current_position = auth_hash[:extra][:raw_info][:positions][:values][0][:title]
user.current_company = auth_hash[:extra][:raw_info][:positions][:values][0][:company][:name] rescue user.current_company = nil
user.current_position = auth_hash[:extra][:raw_info][:positions][:values][0][:title] rescue user.current_position = nil
end
end
end