CSCI 3342 Web Development
Spring 2024

Session and Security

The Awesome Website of Awesome

The epic part.

In this step, you will use your User model to implement a registration/login system for a small but amazing website. Here's how it will look when it's done.

Demo

Here's how the completed site works. The video clip starts on the home page "/", without having logged in yet. The mouse doesn't show at the very beginning, the first click is on the "Awesome Stuff" link.

Before you dive in, watch this short video about how to organize GET/POST routes.

POST, reload, and Redirect (10:04)

How to avoid duplicate POSTs and confusing URLs

Continuing in the same working directory, start server.js with node and prepare yourself for the awesome.

  • The user Model should be complete from the last step.
  • The template Views are already complete (don't change anything in them!).
  • Your job is to complete the Controller (the routes in server.js) so that it works with those other parts. See the checklist below and the extensive comments in server.js.
The starting database has a regular username/password:
testguy/testguy
And an admin username/password:
admin/admin

Assignment Checklist

Complete the / GET route
Complete the /login GET and POST routes
Complete the /register GET and POST routes
Complete the /content GET route
The /logout GET route is already completed, note how it removes the user from session