aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mediagoblin/auth/lib.py2
-rw-r--r--mediagoblin/auth/views.py8
-rw-r--r--mediagoblin/tests/test_auth.py2
3 files changed, 6 insertions, 6 deletions
diff --git a/mediagoblin/auth/lib.py b/mediagoblin/auth/lib.py
index d03f7af0..c0af3b5b 100644
--- a/mediagoblin/auth/lib.py
+++ b/mediagoblin/auth/lib.py
@@ -145,7 +145,7 @@ def send_fp_verification_email(user, request):
host=request.host,
uri=request.urlgen('mediagoblin.auth.verify_forgot_password'),
userid=unicode(user._id),
- fp_verification_key=user['fp_verification_key'])})
+ fp_verification_key=user.fp_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 d7e8d1bf..633ceef4 100644
--- a/mediagoblin/auth/views.py
+++ b/mediagoblin/auth/views.py
@@ -250,7 +250,7 @@ def forgot_password(request):
if user:
if user.email_verified and user.status == 'active':
- user[u'fp_verification_key'] = unicode(uuid.uuid4())
+ user.fp_verification_key = unicode(uuid.uuid4())
user[u'fp_token_expire'] = datetime.datetime.now() + \
datetime.timedelta(days=10)
user.save()
@@ -301,8 +301,8 @@ def verify_forgot_password(request):
return render_404(request)
# check if we have a real user and correct token
- if ((user and user['fp_verification_key'] and
- user['fp_verification_key'] == unicode(formdata_token) and
+ 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')):
@@ -311,7 +311,7 @@ def verify_forgot_password(request):
if request.method == 'POST' and cp_form.validate():
user.pw_hash = auth_lib.bcrypt_gen_password_hash(
request.POST['password'])
- user[u'fp_verification_key'] = None
+ user.fp_verification_key = None
user[u'fp_token_expire'] = None
user.save()
diff --git a/mediagoblin/tests/test_auth.py b/mediagoblin/tests/test_auth.py
index 7cb867d7..2dcb5c14 100644
--- a/mediagoblin/tests/test_auth.py
+++ b/mediagoblin/tests/test_auth.py
@@ -270,7 +270,7 @@ def test_register_views(test_app):
# user should have matching parameters
new_user = mg_globals.database.User.find_one({'username': 'happygirl'})
assert parsed_get_params['userid'] == [unicode(new_user._id)]
- assert parsed_get_params['token'] == [new_user['fp_verification_key']]
+ assert parsed_get_params['token'] == [new_user.fp_verification_key]
### The forgotten password token should be set to expire in ~ 10 days
# A few ticks have expired so there are only 9 full days left...