Merge branch 'master' into applications

This commit is contained in:
Andrew Hayward 2013-05-22 10:38:30 -04:00
Родитель df551138b6 201c606279
Коммит 4753244ba2
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -261,6 +261,7 @@ module.exports = function (app) {
app.post('/login', function (req, res, next) {
var username = req.body['username'];
var normalizedUsername = normalizeUsername(username);
var password = req.body['password'];
function finalize (err, user) {
@ -290,7 +291,7 @@ module.exports = function (app) {
return finalize(new Error('Missing nickname or password'));
// Annoying redundancy here, but no other obvious way to generate OR queries
learners.find({where: ["`email`=? OR `username`=?", username, username]})
learners.find({where: ["`email`=? OR `username`=?", normalizedUsername, normalizedUsername]})
.complete(function(err, user) {
if (err) return finalize(err);
if (user) return validateUser(user);