Permalink
Browse files

Not requiring user to login when associating with an existing account…

… if email matches
  • Loading branch information...
1 parent ff268b3 commit a7774cf39476521bffe484a94667a2283a1911fc @danmorin committed Mar 14, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 app/controllers/spree/omniauth_callbacks_controller.rb
@@ -32,6 +32,12 @@ def social_setup(provider)
#signing back in from a social source
if existing_auth
user = existing_auth.user
+
+ elsif omniauth['user_info'] && user = Spree::User.find_by_email(omniauth['user_info']['email'].downcase)
+ Rails.logger.error "\n\n\nFound: #{user.inspect}\n\n\n"
+ # If their email address matches their facebook email, it's safe to assume it's the user
+ # so we're not making them enter a password to authenticate first
+ # Since we assign user in the IF, there's nothing more to do here :)
else # adding a social source
user = current_user
end

0 comments on commit a7774cf

Please sign in to comment.