mirror of
https://github.com/nodemailer/wildduck.git
synced 2024-12-31 04:33:09 +08:00
v1.0.52
This commit is contained in:
parent
03f9d650bf
commit
a8eb98a870
3 changed files with 33 additions and 2 deletions
|
@ -314,6 +314,37 @@ class UserHandler {
|
|||
});
|
||||
}
|
||||
|
||||
reset(username, callback) {
|
||||
let password = generatePassword.generate({
|
||||
length: 12,
|
||||
uppercase: true,
|
||||
numbers: true,
|
||||
symbols: false
|
||||
});
|
||||
|
||||
return this.database.collection('users').findOneAndUpdate({
|
||||
username
|
||||
}, {
|
||||
$set: {
|
||||
enabled2fa: false,
|
||||
seed: '',
|
||||
requirePasswordChange: true,
|
||||
password: bcrypt.hashSync(password, 11)
|
||||
}
|
||||
}, {}, (err, result) => {
|
||||
if (err) {
|
||||
log.error('DB', 'UPDATEFAIL username=%s error=%s', username, err.message);
|
||||
return callback(new Error('Database Error, failed to reset user credentials'));
|
||||
}
|
||||
|
||||
if (!result || !result.value) {
|
||||
return callback(new Error('Could not update user'));
|
||||
}
|
||||
|
||||
return callback(null, password);
|
||||
});
|
||||
}
|
||||
|
||||
setup2fa(username, issuer, callback) {
|
||||
return this.database.collection('users').findOne({
|
||||
username
|
||||
|
|
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "wildduck",
|
||||
"version": "1.0.50",
|
||||
"version": "1.0.51",
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"@ronomon/crypto-async": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "wildduck",
|
||||
"version": "1.0.51",
|
||||
"version": "1.0.52",
|
||||
"description": "IMAP server built with Node.js and MongoDB",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
|
|
Loading…
Reference in a new issue