diff --git a/data/model.py b/data/model.py index 7b300bedc..15eab7576 100644 --- a/data/model.py +++ b/data/model.py @@ -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 diff --git a/endpoints/api.py b/endpoints/api.py index 530672d87..553ac77e1 100644 --- a/endpoints/api.py +++ b/endpoints/api.py @@ -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) diff --git a/static/directives/signin-form.html b/static/directives/signin-form.html index cf982f08b..814955ce6 100644 --- a/static/directives/signin-form.html +++ b/static/directives/signin-form.html @@ -1,7 +1,7 @@