From: Elrond Date: Mon, 14 Nov 2011 18:04:13 +0000 (+0100) Subject: Dot-Notation for Users.verification_key X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=00bb95502e01f8c8fcaa5652889a5ed423051d7c;p=mediagoblin.git Dot-Notation for Users.verification_key --- diff --git a/mediagoblin/auth/lib.py b/mediagoblin/auth/lib.py index 24992094..d03f7af0 100644 --- a/mediagoblin/auth/lib.py +++ b/mediagoblin/auth/lib.py @@ -110,7 +110,7 @@ def send_verification_email(user, request): host=request.host, uri=request.urlgen('mediagoblin.auth.verify_email'), userid=unicode(user._id), - verification_key=user['verification_key'])}) + verification_key=user.verification_key)}) # TODO: There is no error handling in place send_email( diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index caf9835a..d7e8d1bf 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -166,10 +166,10 @@ def verify_email(request): user = request.db.User.find_one( {'_id': ObjectId(unicode(request.GET['userid']))}) - if user and user['verification_key'] == unicode(request.GET['token']): + if user and user.verification_key == unicode(request.GET['token']): user.status = u'active' user.email_verified = True - user[u'verification_key'] = None + user.verification_key = None user.save() @@ -212,7 +212,7 @@ def resend_activation(request): return redirect(request, "mediagoblin.user_pages.user_home", user=request.user['username']) - request.user[u'verification_key'] = unicode(uuid.uuid4()) + request.user.verification_key = unicode(uuid.uuid4()) request.user.save() email_debug_message(request) diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py index bd79a407..7cb867d7 100644 --- a/mediagoblin/tests/test_auth.py +++ b/mediagoblin/tests/test_auth.py @@ -187,7 +187,7 @@ def test_register_views(test_app): assert parsed_get_params['userid'] == [ unicode(new_user._id)] assert parsed_get_params['token'] == [ - new_user['verification_key']] + new_user.verification_key] ## Try verifying with bs verification key, shouldn't work template.clear_test_template_context()