Dot-Notation for Users.email_verified
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Mon, 14 Nov 2011 17:54:52 +0000 (18:54 +0100)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Mon, 5 Dec 2011 20:08:57 +0000 (21:08 +0100)
mediagoblin/auth/views.py
mediagoblin/gmg_commands/users.py
mediagoblin/tests/test_auth.py

index 63bf9a91a3c02bff13e8455f75348a439ec687dc..2d29d0a54099df2178e200b05672a3bcecd407c1 100644 (file)
@@ -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)
 
index 6084f9d7c67c7b815d061c21bb920b59ccb7659d..8889566113b63bf38f9144bf5eae3697e8647053 100644 (file)
@@ -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)"
index 2faf0f253cf911651610b08f8cd9cf7c176eee8f..ad9a5bca9c4f5e0914cd0fa85b86981e0721b431 100644 (file)
@@ -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
     # -----------------