mirror of
https://github.com/reality/dbot.git
synced 2024-11-23 20:39:25 +01:00
login and logout web routes [#538]
This commit is contained in:
parent
d1d62be6f2
commit
f53b826307
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user