Added the ability to regenerate a verification key.
[mediagoblin.git] / mediagoblin / db / models.py
index 37420834669ea380e48fa113b4537a28328edd70..0e933fb777c4cc631943f5f259bbeb66ea10787e 100644 (file)
@@ -64,6 +64,14 @@ class User(Document):
         return auth_lib.bcrypt_check_password(
             password, self['pw_hash'])
 
+    def generate_new_verification_key(self):
+        """
+        Create a new verification key, overwriting the old one.
+        """
+
+        self['verification_key'] = unicode(uuid.uuid4())
+        self.save(validate=False)
+
 
 class MediaEntry(Document):
     __collection__ = 'media_entries'