aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/db
diff options
context:
space:
mode:
authorAlejandro Villanueva <admin@ialex.org>2011-07-21 11:55:41 -0500
committerCaleb Forbes Davis V <caldavis@gmail.com>2011-08-28 20:08:14 -0500
commit25ba955e20e9262f2599a21d234511b724569717 (patch)
tree4a6fc14ccd9a426f78f2b16377cdc0699bcc9747 /mediagoblin/db
parentad56a4826b987a0fa8f65849d3611f61cc1f50d6 (diff)
downloadmediagoblin-25ba955e20e9262f2599a21d234511b724569717.tar.lz
mediagoblin-25ba955e20e9262f2599a21d234511b724569717.tar.xz
mediagoblin-25ba955e20e9262f2599a21d234511b724569717.zip
Adding fotgot password functionality
Diffstat (limited to 'mediagoblin/db')
-rw-r--r--mediagoblin/db/migrations.py15
-rw-r--r--mediagoblin/db/models.py2
2 files changed, 17 insertions, 0 deletions
diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py
index 5456b248..b0cb6965 100644
--- a/mediagoblin/db/migrations.py
+++ b/mediagoblin/db/migrations.py
@@ -92,3 +92,18 @@ def mediaentry_add_fail_error_and_metadata(database):
{'fail_metadata': {'$exists': False}},
{'$set': {'fail_metadata': {}}},
multi=True)
+
+
+@RegisterMigration(6)
+def user_add_forgot_password_token_and_expires(database):
+ """
+ Add token and expiration fields to help recover forgotten passwords
+ """
+ database['users'].update(
+ {'fp_token': {'$exists': False}},
+ {'$set': {'fp_token': ''}},
+ multi=True)
+ database['users'].update(
+ {'fp_token_expire': {'$exists': False}},
+ {'$set': {'fp_token_expire': ''}},
+ multi=True)
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py
index b6e52441..a626937d 100644
--- a/mediagoblin/db/models.py
+++ b/mediagoblin/db/models.py
@@ -78,6 +78,8 @@ class User(Document):
'url' : unicode,
'bio' : unicode, # May contain markdown
'bio_html': unicode, # May contain plaintext, or HTML
+ 'fp_token': unicode, # forgotten password verification key
+ 'fp_token_expire': datetime.datetime
}
required_fields = ['username', 'created', 'pw_hash', 'email']