1app.post('/login',
2 passport.authenticate('local'),
3 function(req, res) {
4 // If this function gets called, authentication was successful.
5 // `req.user` contains the authenticated user.
6 res.redirect('/users/' + req.user.username);
7 });
8