Allow for email address-based login
This commit is contained in:
parent
9d26c79db0
commit
e5f6a68248
2 changed files with 4 additions and 5 deletions
|
@ -439,9 +439,9 @@ def get_matching_users(username_prefix, robot_namespace=None,
|
||||||
return (MatchingUserResult(*args) for args in query.tuples().limit(10))
|
return (MatchingUserResult(*args) for args in query.tuples().limit(10))
|
||||||
|
|
||||||
|
|
||||||
def verify_user(username, password):
|
def verify_user(username_or_email, password):
|
||||||
try:
|
try:
|
||||||
fetched = User.get(User.username == username)
|
fetched = User.get((User.username == username_or_email) | (User.email == username_or_email))
|
||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -312,12 +312,11 @@ def signin_user():
|
||||||
return conduct_signin(username, password)
|
return conduct_signin(username, password)
|
||||||
|
|
||||||
|
|
||||||
def conduct_signin(username, password):
|
def conduct_signin(username_or_email, password):
|
||||||
#TODO Allow email login
|
|
||||||
needs_email_verification = False
|
needs_email_verification = False
|
||||||
invalid_credentials = False
|
invalid_credentials = False
|
||||||
|
|
||||||
verified = model.verify_user(username, password)
|
verified = model.verify_user(username_or_email, password)
|
||||||
if verified:
|
if verified:
|
||||||
if common_login(verified):
|
if common_login(verified):
|
||||||
return make_response('Success', 200)
|
return make_response('Success', 200)
|
||||||
|
|
Reference in a new issue