3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-24 03:33:07 +01:00

login and logout web routes [#538]

This commit is contained in:
reality 2013-07-27 17:31:00 +00:00
parent d1d62be6f2
commit f53b826307

View File

@ -89,7 +89,22 @@ var webInterface = function(dbot) {
});
this.app.get('/login', function(req, res) {
res.render('login', function(req, res) {
'user': req.user,
'message': req.flash('error');
});
});
this.app.post('/login', passport.authenticate('local', {
'failureRedirect': '/login',
'failureFlash': true
}), function(req, res) {
res.redirect('/');
});
this.app.get('/logout', function(req, res) {
req.logout();
res.redirect('/');
});
}.bind(this);