v1.0.19. fixed broken auth

This commit is contained in:
Andris Reinman 2017-04-21 12:07:38 +03:00
parent c3bc7a091f
commit f7721041e7
2 changed files with 9 additions and 5 deletions

View file

@ -40,7 +40,6 @@ class UserHandler {
* @param {String} username Either username or email address
*/
authenticate(username, password, callback) {
let checkAddress = next => {
if (username.indexOf('@') < 0) {
// assume regular username
@ -62,16 +61,22 @@ class UserHandler {
if (err) {
return callback(err);
}
if (!addressData) {
return callback(null, false);
}
return next(null, {
_id: addressData.user
});
});
};
checkAddress(query => {
checkAddress((err, query) => {
if (err) {
return callback(err);
}
this.database.collection('users').findOne(query, {
fields: {
username: true,
@ -80,7 +85,6 @@ class UserHandler {
asp: true
}
}, (err, userData) => {
if (err) {
return callback(err);
}
@ -113,7 +117,7 @@ class UserHandler {
user: userData._id,
username: userData.username,
scope: 'application',
use2fa: false
enabled2fa: false // application scope never requires 2FA
});
}
}

View file

@ -1,6 +1,6 @@
{
"name": "wildduck",
"version": "1.0.18",
"version": "1.0.19",
"description": "IMAP server built with Node.js and MongoDB",
"main": "server.js",
"scripts": {