From 25ba955e20e9262f2599a21d234511b724569717 Mon Sep 17 00:00:00 2001 From: Alejandro Villanueva Date: Thu, 21 Jul 2011 11:55:41 -0500 Subject: Adding fotgot password functionality --- mediagoblin/db/migrations.py | 15 +++++++++++++++ mediagoblin/db/models.py | 2 ++ 2 files changed, 17 insertions(+) (limited to 'mediagoblin/db') 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'] -- cgit v1.2.3 From 65030735085782be067c8c97e288e9baf3dbdbf4 Mon Sep 17 00:00:00 2001 From: Caleb Forbes Davis V Date: Sun, 28 Aug 2011 21:13:07 -0500 Subject: oops, uses Alejandro's fp_verification_key. my bad. --- mediagoblin/db/migrations.py | 4 ++-- mediagoblin/db/models.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'mediagoblin/db') diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py index b0cb6965..cf09e817 100644 --- a/mediagoblin/db/migrations.py +++ b/mediagoblin/db/migrations.py @@ -100,8 +100,8 @@ 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': ''}}, + {'fp_verification_key': {'$exists': False}}, + {'$set': {'fp_verification_key': ''}}, multi=True) database['users'].update( {'fp_token_expire': {'$exists': False}}, diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index a626937d..ad989f81 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -78,7 +78,7 @@ 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_verification_key': unicode, # forgotten password verification key 'fp_token_expire': datetime.datetime } -- cgit v1.2.3 From 2db31581ed597cab1d148091c1fe8975ee9d70d2 Mon Sep 17 00:00:00 2001 From: Christopher Allan Webber Date: Wed, 7 Sep 2011 20:18:17 -0500 Subject: user_add_forgot_password_token_and_expires migration should set new fields to None/null --- mediagoblin/db/migrations.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mediagoblin/db') diff --git a/mediagoblin/db/migrations.py b/mediagoblin/db/migrations.py index cf09e817..3c3deee8 100644 --- a/mediagoblin/db/migrations.py +++ b/mediagoblin/db/migrations.py @@ -101,9 +101,9 @@ def user_add_forgot_password_token_and_expires(database): """ database['users'].update( {'fp_verification_key': {'$exists': False}}, - {'$set': {'fp_verification_key': ''}}, + {'$set': {'fp_verification_key': None}}, multi=True) database['users'].update( {'fp_token_expire': {'$exists': False}}, - {'$set': {'fp_token_expire': ''}}, + {'$set': {'fp_token_expire': None}}, multi=True) -- cgit v1.2.3