mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-29 02:07:15 +00: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);
|