Skip to content

Instantly share code, notes, and snippets.

@eavgerinos eavgerinos/user.rb Secret
Created Nov 28, 2012

Embed
What would you like to do?
def apply_omniauth(omniauth)
self.email = omniauth['info']['email'] if email.blank?
self.username = omniauth['info']['nickname'] if username.blank?
self.description = omniauth['info']['description'] if description.blank?
self.full_name = omniauth['info']['name'] if full_name.blank?
if omniauth['provider'] == "github"
self.github_link = omniauth['info']['urls']['GitHub']
self.github_username = omniauth['info']['name']
end
if omniauth['provider'] == "twitter"
self.twitter_link = omniauth['info']['urls']['Twitter']
self.twitter_username = omniauth['info']['nickname']
end
if omniauth['provider'] == "linkedin"
self.oauth_token_linkedin = omniauth['credentials']['token']
self.oauth_secret_linkedin = omniauth['credentials']['secret']
self.linkedin_email = omniauth['info']['email']
end
self.save
authentications.build(provider: omniauth['provider'], uid: omniauth['uid'])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.