From e5f6a68248777ec80154c52b6fd529b1a95368b0 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Thu, 16 Jan 2014 16:14:38 -0500 Subject: [PATCH 1/2] Allow for email address-based login --- data/model.py | 4 ++-- endpoints/api.py | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) 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) From 5bbb5d474807a01d1f1b3cdccacc0661bc92e57f Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Thu, 16 Jan 2014 16:16:44 -0500 Subject: [PATCH 2/2] =?UTF-8?q?Show=20=E2=80=9Cor=20email=20address?= =?UTF-8?q?=E2=80=9D=20in=20the=20placeholder=20for=20the=20username=20box?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/directives/signin-form.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@