No need for a method for generating the verification key as a method
authorChristopher Allan Webber <cwebber@dustycloud.org>
Thu, 2 Jun 2011 14:02:13 +0000 (09:02 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Thu, 2 Jun 2011 14:02:13 +0000 (09:02 -0500)
on the class, can just do that in the view

mediagoblin/auth/views.py
mediagoblin/db/models.py

index 0c1255449dbaa06cab30ec4dfbfe6f37168bcf8e..e9d75f8bba75e5e1fbd005bb7b9f084a4fec829f 100644 (file)
@@ -14,6 +14,8 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+import uuid
+
 from webob import Response, exc
 
 from mediagoblin.db.util import ObjectId
@@ -195,8 +197,8 @@ def resend_activation(request):
 
     Resend the activation email.
     """
-
-    request.user.generate_new_verification_key()
+    request.user['verification_key'] = unicode(uuid.uuid4())
+    request.user.save()
 
     # Copied shamelessly from the register view above.
 
index 0b85430adfaa95e13bb32dd98232f943bd2b4cb8..3da97a4911bf641cfd67331a75886f51cd565c99 100644 (file)
@@ -64,14 +64,6 @@ 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'