mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
add migration script for moving facebook auth'd users to local
auth (seems people hate facebook)
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* Set this up as a midnight cron script
|
* Set this up as a midnight cron script
|
||||||
*
|
*
|
||||||
* mongo habitrpg node_modules/moment/moment.js migrations/json.js migrations/20130212_preen_cron.js
|
* mongo habitrpg node_modules/moment/moment.js migrations/20130212_preen_cron.js
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
10
migrations/facebook_to_local.js
Normal file
10
migrations/facebook_to_local.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
var oldId = "",
|
||||||
|
newId = "",
|
||||||
|
newUser = db.users.findOne({_id: newId})
|
||||||
|
|
||||||
|
db.users.update({_id: oldId}, {$set:{auth: newUser.auth}});
|
||||||
|
|
||||||
|
// remove the auth on the new user (which is a template account). The account will be preened automatically later,
|
||||||
|
// this allows us to keep the account around a few days in case there was a mistake
|
||||||
|
db.users.update({_id: newId}, {$unset:{auth:1}});
|
||||||
|
|
||||||
Reference in New Issue
Block a user