Permalink
Browse files

add process_callback to add_provider_to_user method

  • Loading branch information...
1 parent 3264e29 commit aaf08ab92326ef90422e9fdcc4f148c03b5e1f56 @rcarter rcarter committed Jul 13, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/sorcery/controller/submodules/external.rb
@@ -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

0 comments on commit aaf08ab

Please sign in to comment.