Adding fotgot password functionality

This commit is contained in:
Alejandro Villanueva
2011-07-21 11:55:41 -05:00
committed by Caleb Forbes Davis V
parent ad56a4826b
commit 25ba955e20
12 changed files with 346 additions and 7 deletions

View File

@@ -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)

View File

@@ -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']