From e49d445422d6d0e863fdb4df7fd6a75cb43ec07e Mon Sep 17 00:00:00 2001 From: barisusakli Date: Mon, 17 Mar 2014 15:46:53 -0400 Subject: [PATCH 1/2] added err checking --- src/routes/authentication.js | 3 +++ src/user.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/routes/authentication.js b/src/routes/authentication.js index ad85141c75..60e54c0c57 100644 --- a/src/routes/authentication.js +++ b/src/routes/authentication.js @@ -138,6 +138,9 @@ app.post('/login', function(req, res, next) { if (req.body.username && utils.isEmailValid(req.body.username)) { user.getUsernameByEmail(req.body.username, function(err, username) { + if (err) { + return next(err); + } req.body.username = username ? username : req.body.username; login(req, res, next); }); diff --git a/src/user.js b/src/user.js index 6d72f43020..6abb142547 100644 --- a/src/user.js +++ b/src/user.js @@ -414,6 +414,9 @@ var bcrypt = require('bcryptjs'), User.getUsernameByEmail = function(email, callback) { db.getObjectField('email:uid', email, function(err, uid) { + if (err) { + return callback(err); + } User.getUserField(uid, 'username', callback); }); }; From 43e0c726fa5decbb9ec862900d9ccc1f9da637d6 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 17 Mar 2014 15:48:34 -0400 Subject: [PATCH 2/2] relaxed isClientScript regex, fixed #1198 --- src/middleware/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/middleware/index.js b/src/middleware/index.js index 0a97cdfbaf..51882b8b7d 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -144,7 +144,7 @@ function handleErrors(err, req, res, next) { function catch404(req, res, next) { 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);