mirror of
https://github.com/nodemailer/wildduck.git
synced 2024-12-31 04:33:09 +08:00
v1.0.19. fixed broken auth
This commit is contained in:
parent
c3bc7a091f
commit
f7721041e7
2 changed files with 9 additions and 5 deletions
|
@ -40,7 +40,6 @@ class UserHandler {
|
||||||
* @param {String} username Either username or email address
|
* @param {String} username Either username or email address
|
||||||
*/
|
*/
|
||||||
authenticate(username, password, callback) {
|
authenticate(username, password, callback) {
|
||||||
|
|
||||||
let checkAddress = next => {
|
let checkAddress = next => {
|
||||||
if (username.indexOf('@') < 0) {
|
if (username.indexOf('@') < 0) {
|
||||||
// assume regular username
|
// assume regular username
|
||||||
|
@ -62,16 +61,22 @@ class UserHandler {
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!addressData) {
|
if (!addressData) {
|
||||||
return callback(null, false);
|
return callback(null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return next(null, {
|
return next(null, {
|
||||||
_id: addressData.user
|
_id: addressData.user
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
checkAddress(query => {
|
checkAddress((err, query) => {
|
||||||
|
if (err) {
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
|
||||||
this.database.collection('users').findOne(query, {
|
this.database.collection('users').findOne(query, {
|
||||||
fields: {
|
fields: {
|
||||||
username: true,
|
username: true,
|
||||||
|
@ -80,7 +85,6 @@ class UserHandler {
|
||||||
asp: true
|
asp: true
|
||||||
}
|
}
|
||||||
}, (err, userData) => {
|
}, (err, userData) => {
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +117,7 @@ class UserHandler {
|
||||||
user: userData._id,
|
user: userData._id,
|
||||||
username: userData.username,
|
username: userData.username,
|
||||||
scope: 'application',
|
scope: 'application',
|
||||||
use2fa: false
|
enabled2fa: false // application scope never requires 2FA
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "wildduck",
|
"name": "wildduck",
|
||||||
"version": "1.0.18",
|
"version": "1.0.19",
|
||||||
"description": "IMAP server built with Node.js and MongoDB",
|
"description": "IMAP server built with Node.js and MongoDB",
|
||||||
"main": "server.js",
|
"main": "server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in a new issue