Skip to content

Commit

Permalink
add process_callback to add_provider_to_user method
Browse files Browse the repository at this point in the history
  • Loading branch information
rcarter committed Jul 13, 2012
1 parent 3264e29 commit aaf08ab
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/sorcery/controller/submodules/external.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ def access_token(provider)
# If user is logged, he can add all available providers into his account
def add_provider_to_user(provider)
provider_name = provider.to_sym
provider = Config.send(provider_name)
user_hash = provider.get_user_hash
@provider = Config.send(provider)
@provider.process_callback(params,session)
@user_hash = @provider.get_user_hash
config = user_class.sorcery_config

user = current_user.send(config.authentications_class.to_s.downcase.pluralize).build(config.provider_uid_attribute_name => user_hash[:uid], config.provider_attribute_name => provider_name.to_s)
user = current_user.send(config.authentications_class.to_s.downcase.pluralize).build(config.provider_uid_attribute_name => @user_hash[:uid], config.provider_attribute_name => provider_name.to_s)
user.save(:validate => false)

return user
Expand Down

0 comments on commit aaf08ab

Please sign in to comment.