mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 08:25:46 +01:00
banned users cant login, show error messages on failed logins
This commit is contained in:
@@ -136,10 +136,21 @@
|
||||
res.send(header + templates['reset'] + templates['footer']);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
app.post('/login', passport.authenticate('local'), function(req, res) {
|
||||
res.json({success:1});
|
||||
|
||||
app.post('/login', function(req, res, next) {
|
||||
passport.authenticate('local', function(err, user, info) {
|
||||
if(err) {
|
||||
return next(err);
|
||||
}
|
||||
if (!user) {
|
||||
return res.send({ success : false, message : info.message });
|
||||
}
|
||||
req.login({
|
||||
uid: user.uid
|
||||
}, function() {
|
||||
res.send({ success : true, message : 'authentication succeeded' });
|
||||
});
|
||||
})(req, res, next);
|
||||
});
|
||||
|
||||
app.post('/register', function(req, res) {
|
||||
|
||||
Reference in New Issue
Block a user