changed occurances of form.data['whatever'] to form.whatever.data
Conflicts: mediagoblin/plugins/basic_auth/__init__.py mediagoblin/plugins/openid/__init__.py
This commit is contained in:
parent
94d77e1fc1
commit
569873d8f0
@ -90,9 +90,9 @@ def no_auth_logout(request):
|
|||||||
|
|
||||||
def basic_extra_validation(register_form, *args):
|
def basic_extra_validation(register_form, *args):
|
||||||
users_with_username = User.query.filter_by(
|
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(
|
users_with_email = User.query.filter_by(
|
||||||
email=register_form.data['email']).count()
|
email=register_form.email.data).count()
|
||||||
|
|
||||||
extra_validation_passes = True
|
extra_validation_passes = True
|
||||||
|
|
||||||
|
@ -35,21 +35,22 @@ def check_login(user, password):
|
|||||||
|
|
||||||
|
|
||||||
def get_user(form):
|
def get_user(form):
|
||||||
username = form.data['username']
|
if 'username' in form.data:
|
||||||
user = User.query.filter(
|
username = form.username.data
|
||||||
or_(
|
user = User.query.filter(
|
||||||
User.username == username,
|
or_(
|
||||||
User.email == username,
|
User.username == username,
|
||||||
)).first()
|
User.email == username,
|
||||||
return user
|
)).first()
|
||||||
|
return user
|
||||||
|
|
||||||
|
|
||||||
def create_user(registration_form):
|
def create_user(registration_form):
|
||||||
user = get_user(registration_form)
|
user = get_user(registration_form)
|
||||||
if not user and 'password' in registration_form:
|
if not user and 'password' in registration_form:
|
||||||
user = User()
|
user = User()
|
||||||
user.username = registration_form.data['username']
|
user.username = registration_form.username.data
|
||||||
user.email = registration_form.data['email']
|
user.email = registration_form.email.data
|
||||||
user.pw_hash = auth_lib.bcrypt_gen_password_hash(
|
user.pw_hash = auth_lib.bcrypt_gen_password_hash(
|
||||||
registration_form.password.data)
|
registration_form.password.data)
|
||||||
user.verification_key = unicode(uuid.uuid4())
|
user.verification_key = unicode(uuid.uuid4())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user