aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/auth/views.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2013-04-13 20:11:11 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2013-04-13 20:11:11 -0500
commitf4f9d7ca95a7a00096622961c00d3c941ee846b7 (patch)
tree1f6da641b6b140e9f33a1f5e81853bee1f85c9d1 /mediagoblin/auth/views.py
parent50bf38b26ee0cba6c30ed2484bf10155ba853497 (diff)
parentb2c8dbcf8507811fe931a48722ed9c8b530bcdae (diff)
downloadmediagoblin-f4f9d7ca95a7a00096622961c00d3c941ee846b7.tar.lz
mediagoblin-f4f9d7ca95a7a00096622961c00d3c941ee846b7.tar.xz
mediagoblin-f4f9d7ca95a7a00096622961c00d3c941ee846b7.zip
Merge remote-tracking branch 'refs/remotes/tsyesika/599-allow-email-login'
Diffstat (limited to 'mediagoblin/auth/views.py')
-rw-r--r--mediagoblin/auth/views.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py
index 354b48c1..dc408911 100644
--- a/mediagoblin/auth/views.py
+++ b/mediagoblin/auth/views.py
@@ -25,7 +25,7 @@ from mediagoblin.auth import lib as auth_lib
from mediagoblin.auth import forms as auth_forms
from mediagoblin.auth.lib import send_verification_email, \
send_fp_verification_email
-
+from sqlalchemy import or_
def email_debug_message(request):
"""
@@ -113,8 +113,16 @@ def login(request):
login_failed = False
if request.method == 'POST':
+
+ username = login_form.data['username']
+
if login_form.validate():
- user = User.query.filter_by(username=login_form.data['username']).first()
+ user = User.query.filter(
+ or_(
+ User.username == username,
+ User.email == username,
+
+ )).first()
if user and user.check_login(login_form.password.data):
# set up login in session