Skip to content

Commit

Permalink
User._find_user() should return a user, not a list of emails
Browse files Browse the repository at this point in the history
  • Loading branch information
alecdotico committed Mar 11, 2015
1 parent c5cb7d9 commit 407e33d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions engineauth/models.py
Expand Up @@ -341,7 +341,9 @@ def _find_user(cls, auth_id, emails=None):
# TODO: email should only be trusted if it is verified.
assert isinstance(emails, list), 'Emails must be a list'
address = [e['value'] for e in emails]
user = cls.email_model.get_by_emails(address)
emails = cls.email_model.get_by_emails(address)
if emails:
user = cls.get_by_id(int(emails[0].user_id))
return user

@classmethod
Expand Down Expand Up @@ -481,4 +483,4 @@ def remove_inactive(cls, days_ago=30, now=None):
now = now or datetime.datetime.now()
dtd = now + datetime.timedelta(-days_ago)
for s in cls.query(cls.updated < dtd).fetch():
s.key.delete()
s.key.delete()

0 comments on commit 407e33d

Please sign in to comment.