From 479e8a833ba502c976574af77181f60a2a660aec Mon Sep 17 00:00:00 2001 From: Elrond Date: Sun, 25 Dec 2011 20:11:09 +0100 Subject: [PATCH] Move verification key generation to view Instead of creating the email verication key on the db model as a default for the field, create it in the registration view. Now all verification key generation is only in auth/views.py! --- mediagoblin/auth/views.py | 1 + mediagoblin/db/mongo/models.py | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/mediagoblin/auth/views.py b/mediagoblin/auth/views.py index 919aa3cd..66178371 100644 --- a/mediagoblin/auth/views.py +++ b/mediagoblin/auth/views.py @@ -84,6 +84,7 @@ def register(request): user.email = email user.pw_hash = auth_lib.bcrypt_gen_password_hash( request.POST['password']) + user.verification_key = unicode(uuid.uuid4()) user.save(validate=True) # log the user in diff --git a/mediagoblin/db/mongo/models.py b/mediagoblin/db/mongo/models.py index 0e31fc1c..b068fb06 100644 --- a/mediagoblin/db/mongo/models.py +++ b/mediagoblin/db/mongo/models.py @@ -15,7 +15,6 @@ # along with this program. If not, see . import datetime -import uuid from mongokit import Document @@ -88,7 +87,6 @@ class User(Document): 'created': datetime.datetime.utcnow, 'email_verified': False, 'status': u'needs_email_verification', - 'verification_key': lambda: unicode(uuid.uuid4()), 'is_admin': False} def check_login(self, password):