diff --git a/lib/load_gen/activities/add_email.js b/lib/load_gen/activities/add_email.js index d93575a4ce8a7849a3189f510fc7b527eff46951..d059fdba70f8e7d5d548cb5744729720ccaa1795 100644 --- a/lib/load_gen/activities/add_email.js +++ b/lib/load_gen/activities/add_email.js @@ -18,7 +18,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): - * Lloyd Hilaiel <lloyd@hilaiel.com> + * Lloyd Hilaiel <lloyd@hilaiel.com> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or diff --git a/lib/load_gen/user_db.js b/lib/load_gen/user_db.js index 32623da5e544711cee3f8c687cd54ecf47d1e40a..436ae63eff98bf94fc69c527e21d8248755b1717 100644 --- a/lib/load_gen/user_db.js +++ b/lib/load_gen/user_db.js @@ -117,7 +117,10 @@ exports.splitUser = function(user) { return user; } else { var newuser = exports.getNewUser(); - newuser.emails[0] = user.emails.shift(); + // When splitting an account, always split off the *last* email. + // The *first* email may be associated with a pre-created account. + // see issue #681 + newuser.emails[0] = user.emails.pop(); exports.releaseUser(user); return newuser; } diff --git a/lib/wsapi/authenticate_user.js b/lib/wsapi/authenticate_user.js index 97d3f5895cdbfb2f40a597dfd34ac7e2ba899268..c18f55dff149a62fe5cb0b70b72cfd9eda1f3e0c 100644 --- a/lib/wsapi/authenticate_user.js +++ b/lib/wsapi/authenticate_user.js @@ -17,7 +17,7 @@ exports.process = function(req, res) { function fail(reason) { var r = { success: false }; if (reason) r.reason = reason; - logger.debug('authentication fails for user: ' + req.body.email); + logger.debug('authentication fails for user: ' + req.body.email + (reason ? (' - ' + reason) : "")); return res.json(r); } @@ -36,7 +36,7 @@ exports.process = function(req, res) { logger.error("error comparing passwords with bcrypt: " + err); return fail("internal password check error"); } else if (!success) { - return fail("mismatch"); + return fail("mismatch - pass:" + req.body.pass + " - email:" + req.body.email + " - hash:" + hash); } else { if (!req.session) req.session = {}; wsapi.setAuthenticatedUser(req.session, req.body.email);