зеркало из https://github.com/mozilla/CSOL-site.git
Merge branch 'master' into applications
This commit is contained in:
Коммит
4753244ba2
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче