Use these as a guides
http://passportjs.org/guide/configure/
http://passportjs.org/guide/username-password/
The app will need to setup and enable sessions
.
The app will need another Mongoose model (and schema) called User
.
{
username : String,
password : String // this will be unencrypted for now
}
Manually create your admin user in mongo.
You will need a login page, and a login route.
This is what the new routes would look like:
method | path | action | response |
---|---|---|---|
GET | /login | login_form | renders a jade template login form |
POST | /login | login | uses passport module to authenticate. On success: redirect to admin On fail: redirect to login_form |
GET | /logout | logout | destroys the current session then redirects to / |
GET | /admin | admin | gets all [resources] then renders a jade template that lists all items with edit and delete buttons |