```coffeescript
express = require 'express'
passport = require 'passport'

router = express.Router()

router.post '/login', passport.authenticate 'local',
  successRedirect: '/app'
  failureRedirect: '/'
  failureFlash: 'Invalid username or password!'

module.exports = router

```

Fix wrong redirect after logging in
user
```coffeescript
express = require 'express'
passport = require 'passport'

router = express.Router()

router.post '/login', passport.authenticate 'local',
  successRedirect: '/admin'
  failureRedirect: '/'
  failureFlash: 'Invalid username or password!'

module.exports = router

```
assistant