mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 19:46:01 +01:00
closes #1175
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"login": "Login",
|
||||
"username": "Username",
|
||||
"username": "Username / Email",
|
||||
"password": "Password",
|
||||
"remember_me": "Remember Me?",
|
||||
"forgot_password": "Forgot Password?",
|
||||
|
||||
@@ -134,8 +134,17 @@
|
||||
}
|
||||
|
||||
app.post('/logout', logout);
|
||||
app.post('/login', login);
|
||||
app.post('/register', register);
|
||||
app.post('/login', function(req, res, next) {
|
||||
if (req.body.username && utils.isEmailValid(req.body.username)) {
|
||||
user.getUsernameByEmail(req.body.username, function(err, username) {
|
||||
req.body.username = username ? username : req.body.username;
|
||||
login(req, res, next);
|
||||
});
|
||||
} else {
|
||||
login(req, res, next);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -412,6 +412,12 @@ var bcrypt = require('bcryptjs'),
|
||||
db.getObjectField('email:uid', email, callback);
|
||||
};
|
||||
|
||||
User.getUsernameByEmail = function(email, callback) {
|
||||
db.getObjectField('email:uid', email, function(err, uid) {
|
||||
User.getUserField(uid, 'username', callback);
|
||||
});
|
||||
};
|
||||
|
||||
User.isModerator = function(uid, cid, callback) {
|
||||
groups.isMemberByGroupName(uid, 'cid:' + cid + ':privileges:mods', callback);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user