Allow for email address-based login

This commit is contained in:
Joseph Schorr 2014-01-16 16:14:38 -05:00
parent 9d26c79db0
commit e5f6a68248
2 changed files with 4 additions and 5 deletions

View file

@ -439,9 +439,9 @@ def get_matching_users(username_prefix, robot_namespace=None,
return (MatchingUserResult(*args) for args in query.tuples().limit(10))
def verify_user(username, password):
def verify_user(username_or_email, password):
try:
fetched = User.get(User.username == username)
fetched = User.get((User.username == username_or_email) | (User.email == username_or_email))
except User.DoesNotExist:
return None

View file

@ -312,12 +312,11 @@ def signin_user():
return conduct_signin(username, password)
def conduct_signin(username, password):
#TODO Allow email login
def conduct_signin(username_or_email, password):
needs_email_verification = False
invalid_credentials = False
verified = model.verify_user(username, password)
verified = model.verify_user(username_or_email, password)
if verified:
if common_login(verified):
return make_response('Success', 200)