feat(auth): add manual_password_reset migration

This commit is contained in:
Tyler Renelle 2015-03-12 12:09:18 -06:00
parent 8bc5ed83cb
commit 6ed0ff289f

View file

@ -0,0 +1,19 @@
// node ./migrations/manual_password_reset.js
//TODO: CHANGE
var dbserver = 'mongodb://node-a0.server.com:port/habitrpg', //Note, only include primary set
creds = {username:'', password:''},
email = '';
var utils = require('../website/src/utils'),
salt = utils.makeSalt(),
newPassword = utils.makeSalt(), // use a salt as the new password too (they'll change it later)
hashed_password = utils.encryptPassword(newPassword, salt);
console.log(newPassword);
require('mongoskin').db(dbserver, creds).collection('users')
.update({'auth.local.email':email}, {
$set:{
'auth.local.salt': salt,
'auth.local.hashed_password': hashed_password
}
}, process.exit);