Skip to content

Commit

Permalink
Not requiring user to login when associating with an existing account…
Browse files Browse the repository at this point in the history
… if email matches
  • Loading branch information
danmorin committed Mar 14, 2012
1 parent ff268b3 commit a7774cf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/controllers/spree/omniauth_callbacks_controller.rb
Expand Up @@ -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
Expand Down

0 comments on commit a7774cf

Please sign in to comment.