Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Only use provider and provider user IDs to find connection #33

Merged
merged 1 commit into from
Jul 10, 2014

Conversation

pib
Copy link
Contributor

@pib pib commented Feb 18, 2014

Seems overkill to use all the fields just to check if the given connection already exists...

@mattupstate
Copy link
Collaborator

How is this overkill exactly? You've just removed the user_id parameter, no?

@pib
Copy link
Contributor Author

pib commented Feb 18, 2014

No, it's also removing all of the other fields, which includes full_name, display_name, secret, profile_url, etc.

@mattupstate
Copy link
Collaborator

I still don't understand why its overkill.

@pib
Copy link
Contributor Author

pib commented Feb 18, 2014

Because the provider_id and the provider_user_id are all that's needed to uniquely identify a connection. It's a waste of cpu cycles and memory to require all the other fields to be compared and it should have the same end result.

Actually, one difference it might have is if someone changes their profile after linking, in which case it would show up as not linked despite having the same provider_user_id. So I take it back, it's not overkill, it's a bug.

If I link with my google account, then change my display name on that google account, then I would be able to link with that same google account again because it wouldn't match because the display name is different, even though it is literally the same account.

@mattupstate
Copy link
Collaborator

That makes sense to me. Can you provide steps to produce/reproduce this bug? And perhaps even write the required tests to verify the code changes?

@eriktaubeneck
Copy link
Collaborator

This is interesting, because if the access_token and/or secret change, this doesn't fail, nor do we get a second connection object. I'm working on a PR to take care of that situation, but it is interesting that it doesn't fail.

@pib
Copy link
Contributor Author

pib commented Feb 18, 2014

Sure, I'll write some tests which reproduce/demonstrate the bug and then also show that the code changes fix it.

@mattupstate
Copy link
Collaborator

Thanks, Paul!

@eriktaubeneck
Copy link
Collaborator

@pib I just wrote a quick test to see what was going on, but it seems that I don't know enough about the mock library off the top of my head to get it working. The issue I was talking about above was actually only with respect to the login route, and not the connect route (which seems to only look at user_id.) Anyways, you can see the template of a test on this branch.

@eriktaubeneck
Copy link
Collaborator

The issue with my test seems to have to do with this if you're interested.

@pib pib mentioned this pull request Feb 19, 2014
5 tasks
@eriktaubeneck eriktaubeneck merged commit 253eb94 into pallets-eco:develop Jul 10, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants