Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profiles are not associated by email #7

Open
payala opened this issue Oct 3, 2012 · 2 comments
Open

Profiles are not associated by email #7

payala opened this issue Oct 3, 2012 · 2 comments

Comments

@payala
Copy link

payala commented Oct 3, 2012

Current version doesn't seem to be associating different profiles by a common (if present) email address. In fact, the model UserEmail (which I believe is the responsible of this association) seems to never be created at all.

I would expect the UserEmail to be created in the following method of the User model:

    @classmethod
        def _get_or_create(cls, auth_id, emails, **kwarg):
            assert isinstance(emails, list), 'Emails must be a list'
            user = cls._find_user(auth_id, emails)
    #        if user and emails is not None:
    #            user._add_emails(emails)
            if user is None:
                user = cls._create_user(auth_id, **kwarg)
            return user

But that part of the code is commented out, and I can't find the reason in the logs. Is it safe to remove the comments?, is the User<-Email->UserProfile association done here, or am I completely clueless?.

Thank you so much!

@kylefinley
Copy link
Member

Hi @payala,

You are correct the UserEmail is not being created. I removed the logic, because I wasn't satisfied with the implementation, and I still had some issue that I needed to address. Uncommenting the lines you mentioned will not add Email Address uniqueness validation -- more work needs to be done. Unfortunately I don't have the time to make these changes now, but I will keep this issue open until I do.

If you are interested in adding this functionality yourself. All you need to do is create a UserEmail when creating a User. Then when creating subsequent users do a get_by_id prior to creation. Alternatively, you could add a emails property to the User model, if your comfortable with eventual consistency, i.e. User searches by email maybe delayed, therefore reporting that a user associated with an email address doesn't exist when one actually does.

I hope that helps,

-Kyle

@payala
Copy link
Author

payala commented Oct 3, 2012

OK, I see. It will be useful then to leave this issue open so that others don't rely on this functionality.

Thank you for the suggestions to add the email association!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants