Write a script to do the following (as overall behavior, not script
logic!):
- Prompt a user to log in. Provide a text field for username, and
a password field for password.
- Use a checkbox so a user can indicate whether he/she wants to
register. All users must be registered before they can log in.
The caption of this checkbox should be something like
``Check this box for first time users.''
- Use a submit button to initiate the log in process.
- If the ``first time user'' checkbox is cleared:
- Check the name and password against entries in the database
- If the username is found
- If the password matches
- If NUMFAIL is at least five, print ``Call to
revalidate the account'', then present the login
form again
- If NUMFAIL is less than five:
Reset NUMFAIL to zero, as this is just the
number of consecutive login failure.
Present a document to indicate the user is
logged in. This can be as simple as just a
message saying ``You are now logged in.''
Do not present the login form again!
- If the password does not match
- increment the ``NUMFAIL'' field
- Print ``Incorrect username or password''
- Present the login form again
- If the username is not found
- Print a message at the beginning of the form, and
ask for login again.
- The message should not indicate that the username
is not found. Just ``Incorrect username or password''
should be sufficient.
- If the ``first time user'' checkbox is checked:
- Check to see if the username is already in the database
- If the username is already in the database
- Print a message like ``Username is already used.''
- Present the login form again.
- If the username is not in the database
- Present a new user form.
- Present the username (email address) in text, but not
in a text field.
- Present a text field for a nickname.
- Use a submit button for submission.
- When the user submits, add a new entry in the database.
- Jump to the logged in screen saying ``You are now logged
in.''
Copyright © 2008-05-09 by Tak Auyeung