mirror of
https://github.com/nodemailer/wildduck.git
synced 2024-12-31 04:33:09 +08:00
v1.0.50
This commit is contained in:
parent
d412363554
commit
12834af006
2 changed files with 11 additions and 6 deletions
|
@ -314,7 +314,7 @@ class UserHandler {
|
|||
});
|
||||
}
|
||||
|
||||
setup2fa(username, callback) {
|
||||
setup2fa(username, issuer, callback) {
|
||||
return this.database.collection('users').findOne({
|
||||
username
|
||||
}, {
|
||||
|
@ -340,7 +340,7 @@ class UserHandler {
|
|||
let otpauth_url = speakeasy.otpauthURL({
|
||||
secret: base32.decode(entry.seed),
|
||||
label: username,
|
||||
issuer: 'Wild Duck'
|
||||
issuer
|
||||
});
|
||||
return QRCode.toDataURL(otpauth_url, (err, data_url) => {
|
||||
if (err) {
|
||||
|
@ -353,8 +353,7 @@ class UserHandler {
|
|||
|
||||
let secret = speakeasy.generateSecret({
|
||||
length: 20,
|
||||
name: username,
|
||||
issuer: 'Wild Duck'
|
||||
name: username
|
||||
});
|
||||
|
||||
return this.database.collection('users').findOneAndUpdate({
|
||||
|
@ -374,7 +373,13 @@ class UserHandler {
|
|||
return callback(new Error('Could not update user, check if 2FA is not already enabled'));
|
||||
}
|
||||
|
||||
QRCode.toDataURL(secret.otpauth_url, (err, data_url) => {
|
||||
let otpauth_url = speakeasy.otpauthURL({
|
||||
secret: secret.ascii,
|
||||
label: username,
|
||||
issuer
|
||||
});
|
||||
|
||||
QRCode.toDataURL(otpauth_url, (err, data_url) => {
|
||||
if (err) {
|
||||
log.error('DB', 'QRFAIL username=%s error=%s', username, err.message);
|
||||
return callback(new Error('Failed to generate QR code'));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "wildduck",
|
||||
"version": "1.0.49",
|
||||
"version": "1.0.50",
|
||||
"description": "IMAP server built with Node.js and MongoDB",
|
||||
"main": "server.js",
|
||||
"scripts": {
|
||||
|
|
Loading…
Reference in a new issue