aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElrond <elrond+mediagoblin.org@samba-tng.org>2011-12-25 20:11:09 +0100
committerElrond <elrond+mediagoblin.org@samba-tng.org>2011-12-27 20:17:16 +0100
commit479e8a833ba502c976574af77181f60a2a660aec (patch)
tree4cd948b1c291e194e4eee362edaa74c48e18366b
parent0c0ab3227430b3d55ce9d19b37a01cd2a3c90259 (diff)
downloadmediagoblin-479e8a833ba502c976574af77181f60a2a660aec.tar.lz
mediagoblin-479e8a833ba502c976574af77181f60a2a660aec.tar.xz
mediagoblin-479e8a833ba502c976574af77181f60a2a660aec.zip
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!
-rw-r--r--mediagoblin/auth/views.py1
-rw-r--r--mediagoblin/db/mongo/models.py2
2 files changed, 1 insertions, 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 <http://www.gnu.org/licenses/>.
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):