From: Rodney Ewing Date: Thu, 23 May 2013 20:18:47 +0000 (-0700) Subject: changed occurances of form.data['whatever'] to form.whatever.data X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=569873d8f0a4d71ff82ba79436ef8ae464d41163;p=mediagoblin.git changed occurances of form.data['whatever'] to form.whatever.data Conflicts: mediagoblin/plugins/basic_auth/__init__.py mediagoblin/plugins/openid/__init__.py --- diff --git a/mediagoblin/auth/tools.py b/mediagoblin/auth/tools.py index a1273d3b..ac2f6504 100644 --- a/mediagoblin/auth/tools.py +++ b/mediagoblin/auth/tools.py @@ -90,9 +90,9 @@ def no_auth_logout(request): def basic_extra_validation(register_form, *args): users_with_username = User.query.filter_by( - username=register_form.data['username']).count() + username=register_form.username.data).count() users_with_email = User.query.filter_by( - email=register_form.data['email']).count() + email=register_form.email.data).count() extra_validation_passes = True diff --git a/mediagoblin/plugins/basic_auth/__init__.py b/mediagoblin/plugins/basic_auth/__init__.py index 8dc2e381..74d6b836 100644 --- a/mediagoblin/plugins/basic_auth/__init__.py +++ b/mediagoblin/plugins/basic_auth/__init__.py @@ -35,21 +35,22 @@ def check_login(user, password): def get_user(form): - username = form.data['username'] - user = User.query.filter( - or_( - User.username == username, - User.email == username, - )).first() - return user + if 'username' in form.data: + username = form.username.data + user = User.query.filter( + or_( + User.username == username, + User.email == username, + )).first() + return user def create_user(registration_form): user = get_user(registration_form) if not user and 'password' in registration_form: user = User() - user.username = registration_form.data['username'] - user.email = registration_form.data['email'] + user.username = registration_form.username.data + user.email = registration_form.email.data user.pw_hash = auth_lib.bcrypt_gen_password_hash( registration_form.password.data) user.verification_key = unicode(uuid.uuid4())