mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 21:27:23 +01:00
20 lines
689 B
JavaScript
20 lines
689 B
JavaScript
// 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);
|