Week 14: Lab #28

Cookie Login

DUE: Tuesday, 4/25 @ 5pm



You will be creating a page that has two different behaviors depending on the state of a cookie being set. When the user visits the page without the cookie being set, it will behave as a login page. When the user visits the page after the cookie has been set, it will behave as a welcome page.

The login version of the page must contain:
  1. A text input field for "username".
  2. A password input field for "password".
  3. A submit button.
  4. A blue background (any shade).

When the user enters their information and hits the submit button, a JavaScript event should be triggered which:
  1. Saves the username to a cookie called "username".
  2. Checks to see if the password is correct (this should just be a hardcoded string in your JavaScript).
  3. If the password is correct, set a cookie called "login" to "true".
  4. If the password is incorrect, set a cookie called "login" to "false".
  5. The page refreshes.

The welcome version of the page must contain:
Upload your completed lab by the due date specified above and make sure that you add a working link to it on your class page, otherwise it will not be reviewed and you will not receive credit.