Initial interfaces and support for team syncing worker

This commit is contained in:
Joseph Schorr 2017-02-21 21:07:48 -05:00
parent 94b07e6de9
commit eeadeb9383
12 changed files with 282 additions and 15 deletions

View file

@ -38,11 +38,14 @@ class FederatedUsers(object):
return (None, 'Not supported')
def link_user(self, username_or_email):
(credentials, err_msg) = self.get_user(username_or_email)
if credentials is None:
(user_info, err_msg) = self.get_user(username_or_email)
if user_info is None:
return (None, err_msg)
return self._get_federated_user(credentials.username, credentials.email)
return self.get_federated_user(user_info)
def get_federated_user(self, user_info):
return self._get_federated_user(user_info.username, user_info.email)
def verify_and_link_user(self, username_or_email, password):
""" Verifies the given credentials and, if valid, creates/links a database user to the
@ -111,7 +114,7 @@ class FederatedUsers(object):
prompts=prompts)
else:
# Update the db attributes from the federated service.
if email:
if email and db_user.email != email:
db_user.email = email
db_user.save()