psychobunny 11 years ago
commit c6a89b504f

@ -144,7 +144,7 @@ function handleErrors(err, req, res, next) {
function catch404(req, res, next) { function catch404(req, res, next) {
var isLanguage = new RegExp('^' + nconf.get('relative_path') + '/language/[\\w]{2,}/.*.json'), var isLanguage = new RegExp('^' + nconf.get('relative_path') + '/language/[\\w]{2,}/.*.json'),
isClientScript = new RegExp('^' + nconf.get('relative_path') + '\\/src\\/forum(\\/admin)?\\/[\\w]+\\.js'); isClientScript = new RegExp('^' + nconf.get('relative_path') + '\\/src\\/forum(\\/admin)?\\/.+\\.js');
res.status(404); res.status(404);

@ -138,6 +138,9 @@
app.post('/login', function(req, res, next) { app.post('/login', function(req, res, next) {
if (req.body.username && utils.isEmailValid(req.body.username)) { if (req.body.username && utils.isEmailValid(req.body.username)) {
user.getUsernameByEmail(req.body.username, function(err, username) { user.getUsernameByEmail(req.body.username, function(err, username) {
if (err) {
return next(err);
}
req.body.username = username ? username : req.body.username; req.body.username = username ? username : req.body.username;
login(req, res, next); login(req, res, next);
}); });

@ -414,6 +414,9 @@ var bcrypt = require('bcryptjs'),
User.getUsernameByEmail = function(email, callback) { User.getUsernameByEmail = function(email, callback) {
db.getObjectField('email:uid', email, function(err, uid) { db.getObjectField('email:uid', email, function(err, uid) {
if (err) {
return callback(err);
}
User.getUserField(uid, 'username', callback); User.getUserField(uid, 'username', callback);
}); });
}; };

Loading…
Cancel
Save