mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-20 04:38:55 +00:00
feat(auth): add manual_password_reset migration
This commit is contained in:
parent
8bc5ed83cb
commit
6ed0ff289f
1 changed files with 19 additions and 0 deletions
19
migrations/manual_password_reset.js
Normal file
19
migrations/manual_password_reset.js
Normal 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);
|
||||
Loading…
Reference in a new issue