From 4facc7a0a21a57023f0d3707f1a3483ca7a560c8 Mon Sep 17 00:00:00 2001 From: Elrond Date: Mon, 14 Nov 2011 18:54:52 +0100 Subject: [PATCH] Dot-Notation for Users.email_verified --- mediagoblin/auth/views.py | 6 +++--- mediagoblin/gmg_commands/users.py | 2 +- mediagoblin/tests/test_auth.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 63bf9a91..2d29d0a5 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -168,7 +168,7 @@ def verify_email(request): if user and user['verification_key'] == unicode(request.GET['token']): user[u'status'] = u'active' - user[u'email_verified'] = True + user.email_verified = True user[u'verification_key'] = None user.save() @@ -249,7 +249,7 @@ def forgot_password(request): {'email': request.POST['username']}) if user: - if user['email_verified'] and user['status'] == 'active': + if user.email_verified and user['status'] == 'active': user[u'fp_verification_key'] = unicode(uuid.uuid4()) user[u'fp_token_expire'] = datetime.datetime.now() + \ datetime.timedelta(days=10) @@ -304,7 +304,7 @@ def verify_forgot_password(request): if ((user and user['fp_verification_key'] and user['fp_verification_key'] == unicode(formdata_token) and datetime.datetime.now() < user['fp_token_expire'] - and user['email_verified'] and user['status'] == 'active')): + and user.email_verified and user['status'] == 'active')): cp_form = auth_forms.ChangePassForm(formdata_vars) diff --git a/mediagoblin/gmg_commands/users.py b/mediagoblin/gmg_commands/users.py index 6084f9d7..88895661 100644 --- a/mediagoblin/gmg_commands/users.py +++ b/mediagoblin/gmg_commands/users.py @@ -54,7 +54,7 @@ def adduser(args): entry.email = unicode(args.email) entry.pw_hash = auth_lib.bcrypt_gen_password_hash(args.password) entry['status'] = u'active' - entry['email_verified'] = True + entry.email_verified = True entry.save(validate=True) print "User created (and email marked as verified)" diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py index 2faf0f25..ad9a5bca 100644 --- a/mediagoblin/tests/test_auth.py +++ b/mediagoblin/tests/test_auth.py @@ -163,7 +163,7 @@ def test_register_views(test_app): {'username': 'happygirl'}) assert new_user assert new_user['status'] == u'needs_email_verification' - assert new_user['email_verified'] == False + assert new_user.email_verified == False ## Make sure user is logged in request = template.TEMPLATE_TEST_CONTEXT[ @@ -203,7 +203,7 @@ def test_register_views(test_app): {'username': 'happygirl'}) assert new_user assert new_user['status'] == u'needs_email_verification' - assert new_user['email_verified'] == False + assert new_user.email_verified == False ## Verify the email activation works template.clear_test_template_context() @@ -217,7 +217,7 @@ def test_register_views(test_app): {'username': 'happygirl'}) assert new_user assert new_user['status'] == u'active' - assert new_user['email_verified'] == True + assert new_user.email_verified == True # Uniqueness checks # ----------------- -- 2.25.1